Skip to content

Commit 5c71fef

Browse files
authored
Merge pull request #35 from civo/feat/introduce-external-snapshotter
Introduce external snapshotter and snapshot controller for VolumeSnapshot support
2 parents 1eaa5d6 + c2151b8 commit 5c71fef

File tree

6 files changed

+144
-2
lines changed

6 files changed

+144
-2
lines changed

deploy/install.yaml

+54-1
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,46 @@ roleRef:
148148
name: external-resizer-runner
149149
apiGroup: rbac.authorization.k8s.io
150150
---
151+
kind: ClusterRole
152+
apiVersion: rbac.authorization.k8s.io/v1
153+
metadata:
154+
name: external-snapshotter-runner
155+
rules:
156+
- apiGroups: [""]
157+
resources: ["events"]
158+
verbs: ["list", "watch", "create", "update", "patch"]
159+
- apiGroups: ["snapshot.storage.k8s.io"]
160+
resources: ["volumesnapshotclasses"]
161+
verbs: ["get", "list", "watch"]
162+
- apiGroups: ["snapshot.storage.k8s.io"]
163+
resources: ["volumesnapshotcontents"]
164+
verbs: ["get", "list", "watch", "update", "patch"]
165+
- apiGroups: ["snapshot.storage.k8s.io"]
166+
resources: ["volumesnapshotcontents/status"]
167+
verbs: ["update", "patch"]
168+
- apiGroups: ["groupsnapshot.storage.k8s.io"]
169+
resources: ["volumegroupsnapshotclasses"]
170+
verbs: ["get", "list", "watch"]
171+
- apiGroups: ["groupsnapshot.storage.k8s.io"]
172+
resources: ["volumegroupsnapshotcontents"]
173+
verbs: ["get", "list", "watch", "update", "patch"]
174+
- apiGroups: ["groupsnapshot.storage.k8s.io"]
175+
resources: ["volumegroupsnapshotcontents/status"]
176+
verbs: ["update", "patch"]
177+
---
178+
kind: ClusterRoleBinding
179+
apiVersion: rbac.authorization.k8s.io/v1
180+
metadata:
181+
name: csi-snapshotter-role
182+
subjects:
183+
- kind: ServiceAccount
184+
name: civo-csi-controller-sa
185+
namespace: kube-system
186+
roleRef:
187+
kind: ClusterRole
188+
name: external-snapshotter-runner
189+
apiGroup: rbac.authorization.k8s.io
190+
---
151191
apiVersion: storage.k8s.io/v1
152192
kind: CSIDriver
153193
metadata:
@@ -225,7 +265,7 @@ spec:
225265
- name: socket-dir
226266
mountPath: /var/lib/kubelet/plugins/csi.civo.com
227267
- name: csi-resizer
228-
image: k8s.gcr.io/sig-storage/csi-resizer:v1.4.0
268+
image: k8s.gcr.io/sig-storage/csi-resizer:v1.4.0
229269
args:
230270
- "--v=5"
231271
- "--csi-address=$(ADDRESS)"
@@ -237,6 +277,19 @@ spec:
237277
volumeMounts:
238278
- name: socket-dir
239279
mountPath: /var/lib/kubelet/plugins/csi.civo.com
280+
- name: csi-snapshotter
281+
image: k8s.gcr.io/sig-storage/csi-snapshotter:v8.1.0
282+
args:
283+
- "--v=5"
284+
- "--csi-address=$(ADDRESS)"
285+
- "--timeout=30s"
286+
env:
287+
- name: ADDRESS
288+
value: /var/lib/kubelet/plugins/csi.civo.com/csi.sock
289+
imagePullPolicy: "IfNotPresent"
290+
volumeMounts:
291+
- name: socket-dir
292+
mountPath: /var/lib/kubelet/plugins/csi.civo.com
240293
- name: civo-csi-plugin
241294
image: gcr.io/consummate-yew-302509/csi:latest
242295
env:

deploy/kubernetes/01_rbac.yaml

+40
Original file line numberDiff line numberDiff line change
@@ -147,3 +147,43 @@ roleRef:
147147
kind: ClusterRole
148148
name: external-resizer-runner
149149
apiGroup: rbac.authorization.k8s.io
150+
---
151+
kind: ClusterRole
152+
apiVersion: rbac.authorization.k8s.io/v1
153+
metadata:
154+
name: external-snapshotter-runner
155+
rules:
156+
- apiGroups: [""]
157+
resources: ["events"]
158+
verbs: ["list", "watch", "create", "update", "patch"]
159+
- apiGroups: ["snapshot.storage.k8s.io"]
160+
resources: ["volumesnapshotclasses"]
161+
verbs: ["get", "list", "watch"]
162+
- apiGroups: ["snapshot.storage.k8s.io"]
163+
resources: ["volumesnapshotcontents"]
164+
verbs: ["get", "list", "watch", "update", "patch"]
165+
- apiGroups: ["snapshot.storage.k8s.io"]
166+
resources: ["volumesnapshotcontents/status"]
167+
verbs: ["update", "patch"]
168+
- apiGroups: ["groupsnapshot.storage.k8s.io"]
169+
resources: ["volumegroupsnapshotclasses"]
170+
verbs: ["get", "list", "watch"]
171+
- apiGroups: ["groupsnapshot.storage.k8s.io"]
172+
resources: ["volumegroupsnapshotcontents"]
173+
verbs: ["get", "list", "watch", "update", "patch"]
174+
- apiGroups: ["groupsnapshot.storage.k8s.io"]
175+
resources: ["volumegroupsnapshotcontents/status"]
176+
verbs: ["update", "patch"]
177+
---
178+
kind: ClusterRoleBinding
179+
apiVersion: rbac.authorization.k8s.io/v1
180+
metadata:
181+
name: csi-snapshotter-role
182+
subjects:
183+
- kind: ServiceAccount
184+
name: civo-csi-controller-sa
185+
namespace: kube-system
186+
roleRef:
187+
kind: ClusterRole
188+
name: external-snapshotter-runner
189+
apiGroup: rbac.authorization.k8s.io

deploy/kubernetes/04_controller.yaml

+14-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ spec:
5858
- name: socket-dir
5959
mountPath: /var/lib/kubelet/plugins/csi.civo.com
6060
- name: csi-resizer
61-
image: k8s.gcr.io/sig-storage/csi-resizer:v1.4.0
61+
image: k8s.gcr.io/sig-storage/csi-resizer:v1.4.0
6262
args:
6363
- "--v=5"
6464
- "--csi-address=$(ADDRESS)"
@@ -70,6 +70,19 @@ spec:
7070
volumeMounts:
7171
- name: socket-dir
7272
mountPath: /var/lib/kubelet/plugins/csi.civo.com
73+
- name: csi-snapshotter
74+
image: k8s.gcr.io/sig-storage/csi-snapshotter:v8.1.0
75+
args:
76+
- "--v=5"
77+
- "--csi-address=$(ADDRESS)"
78+
- "--timeout=30s"
79+
env:
80+
- name: ADDRESS
81+
value: /var/lib/kubelet/plugins/csi.civo.com/csi.sock
82+
imagePullPolicy: "IfNotPresent"
83+
volumeMounts:
84+
- name: socket-dir
85+
mountPath: /var/lib/kubelet/plugins/csi.civo.com
7386
- name: civo-csi-plugin
7487
image: gcr.io/consummate-yew-302509/csi:latest
7588
env:

deploy/kubernetes/kustomization.yaml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- snapshot-controller
5+
6+
# For CSI driver
7+
- 01_rbac.yaml
8+
- 02_csi_driver.yaml
9+
- 03_storage_class.yaml
10+
- 04_controller.yaml
11+
- 05_node.yaml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
# For CRD
5+
- https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/release-8.1/client/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml
6+
- https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/release-8.1/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml
7+
- https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/release-8.1/client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml
8+
9+
## For snapshot-controller
10+
- https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/v8.0.1/deploy/kubernetes/snapshot-controller/setup-snapshot-controller.yaml
11+
- https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/v8.0.1/deploy/kubernetes/snapshot-controller/rbac-snapshot-controller.yaml
12+
13+
# For VolumeSnapshotClass
14+
- volume_snapshot_class.yaml
15+
16+
images:
17+
- name: registry.k8s.io/sig-storage/snapshot-controller:v7.0.1
18+
newName: k8s.gcr.io/sig-storage/snapshot-controller
19+
newTag: v8.0.1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: snapshot.storage.k8s.io/v1
2+
kind: VolumeSnapshotClass
3+
metadata:
4+
name: civo-volume-snapshot
5+
driver: csi.civo.com
6+
deletionPolicy: Delete

0 commit comments

Comments
 (0)