-
Notifications
You must be signed in to change notification settings - Fork 275
feat: implement snapshots as tarballs #430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
k8s-ci-robot
merged 5 commits into
kubernetes-csi:master
from
wozniakjan:snapshots_with_tarballs
Apr 8, 2023
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1302b43
feat: add csi-snapshotter sidecar and external-snapshotter
wozniakjan aeb0a8d
feat: add SnapshotClass and VolumeSnapshot example
wozniakjan ce66bf8
feat: implement volume snapshots
wozniakjan 8694d47
test: copy volume from snapshot unit tests
wozniakjan 6881ee5
chore: go mod
wozniakjan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
charts/latest/csi-driver-nfs/templates/csi-snapshot-controller.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{{- if .Values.externalSnapshotter.enabled -}} | ||
# This YAML file shows how to deploy the snapshot controller | ||
|
||
# The snapshot controller implements the control loop for CSI snapshot functionality. | ||
# It should be installed as part of the base Kubernetes distribution in an appropriate | ||
# namespace for components implementing base system functionality. For installing with | ||
# Vanilla Kubernetes, kube-system makes sense for the namespace. | ||
--- | ||
kind: Deployment | ||
apiVersion: apps/v1 | ||
metadata: | ||
name: {{ .Values.externalSnapshotter.name }} | ||
namespace: {{ .Release.Namespace }} | ||
{{ include "nfs.labels" . | indent 2 }} | ||
app: {{ .Values.externalSnapshotter.name }} | ||
{{- with .Values.externalSnapshotter.labels }} | ||
{{ . | toYaml | indent 4 }} | ||
{{- end }} | ||
{{- with .Values.externalSnapshotter.annotations }} | ||
annotations: | ||
{{ . | toYaml | indent 4 }} | ||
{{- end }} | ||
spec: | ||
replicas: {{ .Values.externalSnapshotter.controller.replicas }} | ||
selector: | ||
matchLabels: | ||
app: {{ .Values.externalSnapshotter.name }} | ||
# the snapshot controller won't be marked as ready if the v1 CRDs are unavailable | ||
# in #504 the snapshot-controller will exit after around 7.5 seconds if it | ||
# can't find the v1 CRDs so this value should be greater than that | ||
minReadySeconds: 15 | ||
strategy: | ||
rollingUpdate: | ||
maxSurge: 0 | ||
maxUnavailable: 1 | ||
type: RollingUpdate | ||
template: | ||
metadata: | ||
labels: | ||
app: {{ .Values.externalSnapshotter.name }} | ||
spec: | ||
serviceAccountName: {{ .Values.externalSnapshotter.name }} | ||
containers: | ||
- name: {{ .Values.externalSnapshotter.name }} | ||
image: {{ .Values.image.externalSnapshotter.repository }}:{{ .Values.image.externalSnapshotter.tag }} | ||
args: | ||
- "--v=5" | ||
- "--leader-election=true" | ||
- "--leader-election-namespace={{ .Release.Namespace }}" | ||
imagePullPolicy: {{ .Values.image.externalSnapshotter.pullPolicy }} | ||
{{- end -}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
charts/latest/csi-driver-nfs/templates/rbac-snapshot-controller.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
{{- if .Values.externalSnapshotter.enabled -}} | ||
# RBAC file for the snapshot controller. | ||
# | ||
# The snapshot controller implements the control loop for CSI snapshot functionality. | ||
# It should be installed as part of the base Kubernetes distribution in an appropriate | ||
# namespace for components implementing base system functionality. For installing with | ||
# Vanilla Kubernetes, kube-system makes sense for the namespace. | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ .Values.externalSnapshotter.name }} | ||
namespace: {{ .Release.Namespace }} | ||
{{ include "nfs.labels" . | indent 2 }} | ||
|
||
--- | ||
kind: ClusterRole | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: {{ .Values.externalSnapshotter.name }}-runner | ||
{{ include "nfs.labels" . | indent 2 }} | ||
rules: | ||
- apiGroups: [""] | ||
resources: ["persistentvolumes"] | ||
verbs: ["get", "list", "watch"] | ||
- apiGroups: [""] | ||
resources: ["persistentvolumeclaims"] | ||
verbs: ["get", "list", "watch", "update"] | ||
- apiGroups: [""] | ||
resources: ["events"] | ||
verbs: ["list", "watch", "create", "update", "patch"] | ||
- apiGroups: ["snapshot.storage.k8s.io"] | ||
resources: ["volumesnapshotclasses"] | ||
verbs: ["get", "list", "watch"] | ||
- apiGroups: ["snapshot.storage.k8s.io"] | ||
resources: ["volumesnapshotcontents"] | ||
verbs: ["create", "get", "list", "watch", "update", "delete", "patch"] | ||
- apiGroups: ["snapshot.storage.k8s.io"] | ||
resources: ["volumesnapshotcontents/status"] | ||
verbs: ["patch"] | ||
- apiGroups: ["snapshot.storage.k8s.io"] | ||
resources: ["volumesnapshots"] | ||
verbs: ["get", "list", "watch", "update", "patch"] | ||
- apiGroups: ["snapshot.storage.k8s.io"] | ||
resources: ["volumesnapshots/status"] | ||
verbs: ["update", "patch"] | ||
{{- if .Values.externalSnapshotter.enabledDistributedSnapshotting }} | ||
- apiGroups: [""] | ||
resources: ["nodes"] | ||
verbs: ["get", "list", "watch"] | ||
{{- end }} | ||
--- | ||
kind: ClusterRoleBinding | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: {{ .Values.externalSnapshotter.name }}-role | ||
{{ include "nfs.labels" . | indent 2 }} | ||
subjects: | ||
- kind: ServiceAccount | ||
name: {{ .Values.externalSnapshotter.name }} | ||
namespace: {{ .Release.Namespace }} | ||
roleRef: | ||
kind: ClusterRole | ||
name: {{ .Values.externalSnapshotter.name }}-runner | ||
apiGroup: rbac.authorization.k8s.io | ||
|
||
--- | ||
kind: Role | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: {{ .Values.externalSnapshotter.name }}-leaderelection | ||
namespace: {{ .Release.Namespace }} | ||
{{ include "nfs.labels" . | indent 2 }} | ||
rules: | ||
- apiGroups: ["coordination.k8s.io"] | ||
resources: ["leases"] | ||
verbs: ["get", "watch", "list", "delete", "update", "create"] | ||
|
||
--- | ||
kind: RoleBinding | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: {{ .Values.externalSnapshotter.name }}-leaderelection | ||
namespace: {{ .Release.Namespace }} | ||
{{ include "nfs.labels" . | indent 2 }} | ||
subjects: | ||
- kind: ServiceAccount | ||
name: {{ .Values.externalSnapshotter.name }} | ||
roleRef: | ||
kind: Role | ||
name: {{ .Values.externalSnapshotter.name }}-leaderelection | ||
apiGroup: rbac.authorization.k8s.io | ||
{{- end -}} |
146 changes: 146 additions & 0 deletions
146
charts/latest/csi-driver-nfs/templates/snapshot.storage.k8s.io_volumesnapshotclasses.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
{{- if .Values.externalSnapshotter.enabled -}} | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.8.0 | ||
api-approved.kubernetes.io: https://github.com/kubernetes-csi/external-snapshotter/pull/665 | ||
name: volumesnapshotclasses.snapshot.storage.k8s.io | ||
spec: | ||
group: snapshot.storage.k8s.io | ||
names: | ||
kind: VolumeSnapshotClass | ||
listKind: VolumeSnapshotClassList | ||
plural: volumesnapshotclasses | ||
shortNames: [vsclass, vsclasses] | ||
singular: volumesnapshotclass | ||
scope: Cluster | ||
versions: | ||
- additionalPrinterColumns: | ||
- jsonPath: .driver | ||
name: Driver | ||
type: string | ||
- description: Determines whether a VolumeSnapshotContent created through | ||
the VolumeSnapshotClass should be deleted when its bound VolumeSnapshot | ||
is deleted. | ||
jsonPath: .deletionPolicy | ||
name: DeletionPolicy | ||
type: string | ||
- jsonPath: .metadata.creationTimestamp | ||
name: Age | ||
type: date | ||
name: v1 | ||
schema: | ||
openAPIV3Schema: | ||
description: VolumeSnapshotClass specifies parameters that a underlying | ||
storage system uses when creating a volume snapshot. A specific VolumeSnapshotClass | ||
is used by specifying its name in a VolumeSnapshot object. VolumeSnapshotClasses | ||
are non-namespaced | ||
properties: | ||
apiVersion: | ||
description: 'APIVersion defines the versioned schema of this representation | ||
of an object. Servers should convert recognized schemas to the latest | ||
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' | ||
type: string | ||
deletionPolicy: | ||
description: deletionPolicy determines whether a VolumeSnapshotContent | ||
created through the VolumeSnapshotClass should be deleted when its | ||
bound VolumeSnapshot is deleted. Supported values are "Retain" and | ||
"Delete". "Retain" means that the VolumeSnapshotContent and its physical | ||
snapshot on underlying storage system are kept. "Delete" means that | ||
the VolumeSnapshotContent and its physical snapshot on underlying | ||
storage system are deleted. Required. | ||
enum: [Delete, Retain] | ||
type: string | ||
driver: | ||
description: driver is the name of the storage driver that handles this | ||
VolumeSnapshotClass. Required. | ||
type: string | ||
kind: | ||
description: 'Kind is a string value representing the REST resource | ||
this object represents. Servers may infer this from the endpoint the | ||
client submits requests to. Cannot be updated. In CamelCase. More | ||
info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' | ||
type: string | ||
parameters: | ||
additionalProperties: | ||
type: string | ||
description: parameters is a key-value map with storage driver specific | ||
parameters for creating snapshots. These values are opaque to Kubernetes. | ||
type: object | ||
required: [deletionPolicy, driver] | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: {} | ||
- additionalPrinterColumns: | ||
- jsonPath: .driver | ||
name: Driver | ||
type: string | ||
- description: Determines whether a VolumeSnapshotContent created through | ||
the VolumeSnapshotClass should be deleted when its bound VolumeSnapshot | ||
is deleted. | ||
jsonPath: .deletionPolicy | ||
name: DeletionPolicy | ||
type: string | ||
- jsonPath: .metadata.creationTimestamp | ||
name: Age | ||
type: date | ||
name: v1beta1 | ||
# This indicates the v1beta1 version of the custom resource is deprecated. | ||
# API requests to this version receive a warning in the server response. | ||
deprecated: true | ||
# This overrides the default warning returned to clients making v1beta1 API requests. | ||
deprecationWarning: snapshot.storage.k8s.io/v1beta1 VolumeSnapshotClass is deprecated; | ||
use snapshot.storage.k8s.io/v1 VolumeSnapshotClass | ||
schema: | ||
openAPIV3Schema: | ||
description: VolumeSnapshotClass specifies parameters that a underlying | ||
storage system uses when creating a volume snapshot. A specific VolumeSnapshotClass | ||
is used by specifying its name in a VolumeSnapshot object. VolumeSnapshotClasses | ||
are non-namespaced | ||
properties: | ||
apiVersion: | ||
description: 'APIVersion defines the versioned schema of this representation | ||
of an object. Servers should convert recognized schemas to the latest | ||
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' | ||
type: string | ||
deletionPolicy: | ||
description: deletionPolicy determines whether a VolumeSnapshotContent | ||
created through the VolumeSnapshotClass should be deleted when its | ||
bound VolumeSnapshot is deleted. Supported values are "Retain" and | ||
"Delete". "Retain" means that the VolumeSnapshotContent and its physical | ||
snapshot on underlying storage system are kept. "Delete" means that | ||
the VolumeSnapshotContent and its physical snapshot on underlying | ||
storage system are deleted. Required. | ||
enum: [Delete, Retain] | ||
type: string | ||
driver: | ||
description: driver is the name of the storage driver that handles this | ||
VolumeSnapshotClass. Required. | ||
type: string | ||
kind: | ||
description: 'Kind is a string value representing the REST resource | ||
this object represents. Servers may infer this from the endpoint the | ||
client submits requests to. Cannot be updated. In CamelCase. More | ||
info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' | ||
type: string | ||
parameters: | ||
additionalProperties: | ||
type: string | ||
description: parameters is a key-value map with storage driver specific | ||
parameters for creating snapshots. These values are opaque to Kubernetes. | ||
type: object | ||
required: [deletionPolicy, driver] | ||
type: object | ||
served: false | ||
storage: false | ||
subresources: {} | ||
status: | ||
acceptedNames: | ||
kind: '' | ||
plural: '' | ||
conditions: [] | ||
storedVersions: [] | ||
{{- end -}} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.