Skip to content

Commit 3f5c566

Browse files
authored
Merge pull request #430 from wozniakjan/snapshots_with_tarballs
feat: implement snapshots as tarballs
2 parents fafa015 + 6881ee5 commit 3f5c566

27 files changed

+2987
-15
lines changed
6.28 KB
Binary file not shown.

charts/latest/csi-driver-nfs/templates/csi-nfs-controller.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,22 @@ spec:
6363
resources: {{- toYaml .Values.controller.resources.csiProvisioner | nindent 12 }}
6464
securityContext:
6565
readOnlyRootFilesystem: true
66+
{{- if .Values.externalSnapshotter.enabled }}
67+
- name: csi-snapshotter
68+
image: "{{ .Values.image.csiSnapshotter.repository }}:{{ .Values.image.csiSnapshotter.tag }}"
69+
args:
70+
- "--v=5"
71+
- "--csi-address=$(ADDRESS)"
72+
- "--leader-election-namespace={{ .Release.Namespace }}"
73+
- "--leader-election"
74+
env:
75+
- name: ADDRESS
76+
value: /csi/csi.sock
77+
imagePullPolicy: {{ .Values.image.csiSnapshotter.pullPolicy }}
78+
volumeMounts:
79+
- name: socket-dir
80+
mountPath: /csi
81+
{{- end }}
6682
- name: liveness-probe
6783
image: "{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}"
6884
args:
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{{- if .Values.externalSnapshotter.enabled -}}
2+
# This YAML file shows how to deploy the snapshot controller
3+
4+
# The snapshot controller implements the control loop for CSI snapshot functionality.
5+
# It should be installed as part of the base Kubernetes distribution in an appropriate
6+
# namespace for components implementing base system functionality. For installing with
7+
# Vanilla Kubernetes, kube-system makes sense for the namespace.
8+
---
9+
kind: Deployment
10+
apiVersion: apps/v1
11+
metadata:
12+
name: {{ .Values.externalSnapshotter.name }}
13+
namespace: {{ .Release.Namespace }}
14+
{{ include "nfs.labels" . | indent 2 }}
15+
app: {{ .Values.externalSnapshotter.name }}
16+
{{- with .Values.externalSnapshotter.labels }}
17+
{{ . | toYaml | indent 4 }}
18+
{{- end }}
19+
{{- with .Values.externalSnapshotter.annotations }}
20+
annotations:
21+
{{ . | toYaml | indent 4 }}
22+
{{- end }}
23+
spec:
24+
replicas: {{ .Values.externalSnapshotter.controller.replicas }}
25+
selector:
26+
matchLabels:
27+
app: {{ .Values.externalSnapshotter.name }}
28+
# the snapshot controller won't be marked as ready if the v1 CRDs are unavailable
29+
# in #504 the snapshot-controller will exit after around 7.5 seconds if it
30+
# can't find the v1 CRDs so this value should be greater than that
31+
minReadySeconds: 15
32+
strategy:
33+
rollingUpdate:
34+
maxSurge: 0
35+
maxUnavailable: 1
36+
type: RollingUpdate
37+
template:
38+
metadata:
39+
labels:
40+
app: {{ .Values.externalSnapshotter.name }}
41+
spec:
42+
serviceAccountName: {{ .Values.externalSnapshotter.name }}
43+
containers:
44+
- name: {{ .Values.externalSnapshotter.name }}
45+
image: {{ .Values.image.externalSnapshotter.repository }}:{{ .Values.image.externalSnapshotter.tag }}
46+
args:
47+
- "--v=5"
48+
- "--leader-election=true"
49+
- "--leader-election-namespace={{ .Release.Namespace }}"
50+
imagePullPolicy: {{ .Values.image.externalSnapshotter.pullPolicy }}
51+
{{- end -}}

charts/latest/csi-driver-nfs/templates/rbac-csi-nfs.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@ rules:
3232
- apiGroups: ["storage.k8s.io"]
3333
resources: ["storageclasses"]
3434
verbs: ["get", "list", "watch"]
35+
{{- if .Values.externalSnapshotter.enabled }}
36+
- apiGroups: ["snapshot.storage.k8s.io"]
37+
resources: ["volumesnapshotclasses", "volumesnapshots"]
38+
verbs: ["get", "list", "watch"]
39+
- apiGroups: ["snapshot.storage.k8s.io"]
40+
resources: ["volumesnapshotcontents"]
41+
verbs: ["get", "list", "watch", "update", "patch"]
42+
- apiGroups: ["snapshot.storage.k8s.io"]
43+
resources: ["volumesnapshotcontents/status"]
44+
verbs: ["get", "update", "patch"]
45+
{{- end }}
3546
- apiGroups: [""]
3647
resources: ["events"]
3748
verbs: ["get", "list", "watch", "create", "update", "patch"]
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
{{- if .Values.externalSnapshotter.enabled -}}
2+
# RBAC file for the snapshot controller.
3+
#
4+
# The snapshot controller implements the control loop for CSI snapshot functionality.
5+
# It should be installed as part of the base Kubernetes distribution in an appropriate
6+
# namespace for components implementing base system functionality. For installing with
7+
# Vanilla Kubernetes, kube-system makes sense for the namespace.
8+
---
9+
apiVersion: v1
10+
kind: ServiceAccount
11+
metadata:
12+
name: {{ .Values.externalSnapshotter.name }}
13+
namespace: {{ .Release.Namespace }}
14+
{{ include "nfs.labels" . | indent 2 }}
15+
16+
---
17+
kind: ClusterRole
18+
apiVersion: rbac.authorization.k8s.io/v1
19+
metadata:
20+
name: {{ .Values.externalSnapshotter.name }}-runner
21+
{{ include "nfs.labels" . | indent 2 }}
22+
rules:
23+
- apiGroups: [""]
24+
resources: ["persistentvolumes"]
25+
verbs: ["get", "list", "watch"]
26+
- apiGroups: [""]
27+
resources: ["persistentvolumeclaims"]
28+
verbs: ["get", "list", "watch", "update"]
29+
- apiGroups: [""]
30+
resources: ["events"]
31+
verbs: ["list", "watch", "create", "update", "patch"]
32+
- apiGroups: ["snapshot.storage.k8s.io"]
33+
resources: ["volumesnapshotclasses"]
34+
verbs: ["get", "list", "watch"]
35+
- apiGroups: ["snapshot.storage.k8s.io"]
36+
resources: ["volumesnapshotcontents"]
37+
verbs: ["create", "get", "list", "watch", "update", "delete", "patch"]
38+
- apiGroups: ["snapshot.storage.k8s.io"]
39+
resources: ["volumesnapshotcontents/status"]
40+
verbs: ["patch"]
41+
- apiGroups: ["snapshot.storage.k8s.io"]
42+
resources: ["volumesnapshots"]
43+
verbs: ["get", "list", "watch", "update", "patch"]
44+
- apiGroups: ["snapshot.storage.k8s.io"]
45+
resources: ["volumesnapshots/status"]
46+
verbs: ["update", "patch"]
47+
{{- if .Values.externalSnapshotter.enabledDistributedSnapshotting }}
48+
- apiGroups: [""]
49+
resources: ["nodes"]
50+
verbs: ["get", "list", "watch"]
51+
{{- end }}
52+
---
53+
kind: ClusterRoleBinding
54+
apiVersion: rbac.authorization.k8s.io/v1
55+
metadata:
56+
name: {{ .Values.externalSnapshotter.name }}-role
57+
{{ include "nfs.labels" . | indent 2 }}
58+
subjects:
59+
- kind: ServiceAccount
60+
name: {{ .Values.externalSnapshotter.name }}
61+
namespace: {{ .Release.Namespace }}
62+
roleRef:
63+
kind: ClusterRole
64+
name: {{ .Values.externalSnapshotter.name }}-runner
65+
apiGroup: rbac.authorization.k8s.io
66+
67+
---
68+
kind: Role
69+
apiVersion: rbac.authorization.k8s.io/v1
70+
metadata:
71+
name: {{ .Values.externalSnapshotter.name }}-leaderelection
72+
namespace: {{ .Release.Namespace }}
73+
{{ include "nfs.labels" . | indent 2 }}
74+
rules:
75+
- apiGroups: ["coordination.k8s.io"]
76+
resources: ["leases"]
77+
verbs: ["get", "watch", "list", "delete", "update", "create"]
78+
79+
---
80+
kind: RoleBinding
81+
apiVersion: rbac.authorization.k8s.io/v1
82+
metadata:
83+
name: {{ .Values.externalSnapshotter.name }}-leaderelection
84+
namespace: {{ .Release.Namespace }}
85+
{{ include "nfs.labels" . | indent 2 }}
86+
subjects:
87+
- kind: ServiceAccount
88+
name: {{ .Values.externalSnapshotter.name }}
89+
roleRef:
90+
kind: Role
91+
name: {{ .Values.externalSnapshotter.name }}-leaderelection
92+
apiGroup: rbac.authorization.k8s.io
93+
{{- end -}}
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
{{- if .Values.externalSnapshotter.enabled -}}
2+
---
3+
apiVersion: apiextensions.k8s.io/v1
4+
kind: CustomResourceDefinition
5+
metadata:
6+
annotations:
7+
controller-gen.kubebuilder.io/version: v0.8.0
8+
api-approved.kubernetes.io: https://github.com/kubernetes-csi/external-snapshotter/pull/665
9+
name: volumesnapshotclasses.snapshot.storage.k8s.io
10+
spec:
11+
group: snapshot.storage.k8s.io
12+
names:
13+
kind: VolumeSnapshotClass
14+
listKind: VolumeSnapshotClassList
15+
plural: volumesnapshotclasses
16+
shortNames: [vsclass, vsclasses]
17+
singular: volumesnapshotclass
18+
scope: Cluster
19+
versions:
20+
- additionalPrinterColumns:
21+
- jsonPath: .driver
22+
name: Driver
23+
type: string
24+
- description: Determines whether a VolumeSnapshotContent created through
25+
the VolumeSnapshotClass should be deleted when its bound VolumeSnapshot
26+
is deleted.
27+
jsonPath: .deletionPolicy
28+
name: DeletionPolicy
29+
type: string
30+
- jsonPath: .metadata.creationTimestamp
31+
name: Age
32+
type: date
33+
name: v1
34+
schema:
35+
openAPIV3Schema:
36+
description: VolumeSnapshotClass specifies parameters that a underlying
37+
storage system uses when creating a volume snapshot. A specific VolumeSnapshotClass
38+
is used by specifying its name in a VolumeSnapshot object. VolumeSnapshotClasses
39+
are non-namespaced
40+
properties:
41+
apiVersion:
42+
description: 'APIVersion defines the versioned schema of this representation
43+
of an object. Servers should convert recognized schemas to the latest
44+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
45+
type: string
46+
deletionPolicy:
47+
description: deletionPolicy determines whether a VolumeSnapshotContent
48+
created through the VolumeSnapshotClass should be deleted when its
49+
bound VolumeSnapshot is deleted. Supported values are "Retain" and
50+
"Delete". "Retain" means that the VolumeSnapshotContent and its physical
51+
snapshot on underlying storage system are kept. "Delete" means that
52+
the VolumeSnapshotContent and its physical snapshot on underlying
53+
storage system are deleted. Required.
54+
enum: [Delete, Retain]
55+
type: string
56+
driver:
57+
description: driver is the name of the storage driver that handles this
58+
VolumeSnapshotClass. Required.
59+
type: string
60+
kind:
61+
description: 'Kind is a string value representing the REST resource
62+
this object represents. Servers may infer this from the endpoint the
63+
client submits requests to. Cannot be updated. In CamelCase. More
64+
info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
65+
type: string
66+
parameters:
67+
additionalProperties:
68+
type: string
69+
description: parameters is a key-value map with storage driver specific
70+
parameters for creating snapshots. These values are opaque to Kubernetes.
71+
type: object
72+
required: [deletionPolicy, driver]
73+
type: object
74+
served: true
75+
storage: true
76+
subresources: {}
77+
- additionalPrinterColumns:
78+
- jsonPath: .driver
79+
name: Driver
80+
type: string
81+
- description: Determines whether a VolumeSnapshotContent created through
82+
the VolumeSnapshotClass should be deleted when its bound VolumeSnapshot
83+
is deleted.
84+
jsonPath: .deletionPolicy
85+
name: DeletionPolicy
86+
type: string
87+
- jsonPath: .metadata.creationTimestamp
88+
name: Age
89+
type: date
90+
name: v1beta1
91+
# This indicates the v1beta1 version of the custom resource is deprecated.
92+
# API requests to this version receive a warning in the server response.
93+
deprecated: true
94+
# This overrides the default warning returned to clients making v1beta1 API requests.
95+
deprecationWarning: snapshot.storage.k8s.io/v1beta1 VolumeSnapshotClass is deprecated;
96+
use snapshot.storage.k8s.io/v1 VolumeSnapshotClass
97+
schema:
98+
openAPIV3Schema:
99+
description: VolumeSnapshotClass specifies parameters that a underlying
100+
storage system uses when creating a volume snapshot. A specific VolumeSnapshotClass
101+
is used by specifying its name in a VolumeSnapshot object. VolumeSnapshotClasses
102+
are non-namespaced
103+
properties:
104+
apiVersion:
105+
description: 'APIVersion defines the versioned schema of this representation
106+
of an object. Servers should convert recognized schemas to the latest
107+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
108+
type: string
109+
deletionPolicy:
110+
description: deletionPolicy determines whether a VolumeSnapshotContent
111+
created through the VolumeSnapshotClass should be deleted when its
112+
bound VolumeSnapshot is deleted. Supported values are "Retain" and
113+
"Delete". "Retain" means that the VolumeSnapshotContent and its physical
114+
snapshot on underlying storage system are kept. "Delete" means that
115+
the VolumeSnapshotContent and its physical snapshot on underlying
116+
storage system are deleted. Required.
117+
enum: [Delete, Retain]
118+
type: string
119+
driver:
120+
description: driver is the name of the storage driver that handles this
121+
VolumeSnapshotClass. Required.
122+
type: string
123+
kind:
124+
description: 'Kind is a string value representing the REST resource
125+
this object represents. Servers may infer this from the endpoint the
126+
client submits requests to. Cannot be updated. In CamelCase. More
127+
info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
128+
type: string
129+
parameters:
130+
additionalProperties:
131+
type: string
132+
description: parameters is a key-value map with storage driver specific
133+
parameters for creating snapshots. These values are opaque to Kubernetes.
134+
type: object
135+
required: [deletionPolicy, driver]
136+
type: object
137+
served: false
138+
storage: false
139+
subresources: {}
140+
status:
141+
acceptedNames:
142+
kind: ''
143+
plural: ''
144+
conditions: []
145+
storedVersions: []
146+
{{- end -}}

0 commit comments

Comments
 (0)