-
Notifications
You must be signed in to change notification settings - Fork 11
/
oci-csi.yml
504 lines (479 loc) · 14 KB
/
oci-csi.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
# oci-csi-00-namespace.yaml
---
apiVersion: v1
kind: Namespace
metadata:
name: oci-csi
annotations:
workload.openshift.io/allowed: management
labels:
"pod-security.kubernetes.io/enforce": "privileged"
"pod-security.kubernetes.io/audit": "privileged"
"pod-security.kubernetes.io/warn": "privileged"
"security.openshift.io/scc.podSecurityLabelSync": "false"
"openshift.io/run-level": "0"
"pod-security.kubernetes.io/enforce-version": "v1.24"
---
# oci-csi-01-config.yaml
apiVersion: v1
kind: Secret
metadata:
creationTimestamp: null
name: oci-volume-provisioner
namespace: oci-csi
stringData:
config.yaml: |
useInstancePrincipals: true
compartment: $COMPARTMENT_ID
vcn: $OCP_VCN_ID
loadBalancer:
subnet1: $OCP_SUBNET_ID
securityListManagementMode: Frontend
securityLists:
$OCP_SUBNET_ID: $OPC_SEC_LIST_ID
rateLimiter:
rateLimitQPSRead: 20.0
rateLimitBucketRead: 5
rateLimitQPSWrite: 20.0
rateLimitBucketWrite: 5
---
# oci-csi-02-controller-driver.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
deprecated.daemonset.template.generation: "1"
generation: 1
name: csi-oci-controller
namespace: oci-csi
spec:
revisionHistoryLimit: 10
selector:
matchLabels:
app: csi-oci-controller
template:
metadata:
creationTimestamp: null
labels:
app: csi-oci-controller
role: csi-oci
spec:
nodeSelector:
node-role.kubernetes.io/control-plane: ""
containers:
- name: csi-volume-provisioner
image: k8s.gcr.io/sig-storage/csi-provisioner:v3.2.1
args:
- --csi-address=/var/run/shared-tmpfs/csi.sock
- --volume-name-prefix=csi
- --feature-gates=Topology=true
- --timeout=120s
- --leader-election
- --leader-election-namespace=oci-csi
volumeMounts:
- name: config
mountPath: /etc/oci/
readOnly: true
- mountPath: /var/run/shared-tmpfs
name: shared-tmpfs
- name: csi-fss-volume-provisioner
image: k8s.gcr.io/sig-storage/csi-provisioner:v3.2.1
args:
- --csi-address=/var/run/shared-tmpfs/csi-fss.sock
- --volume-name-prefix=csi-fss
- --feature-gates=Topology=true
- --timeout=120s
- --leader-election
- --leader-election-namespace=oci-csi
volumeMounts:
- name: config
mountPath: /etc/oci/
readOnly: true
- mountPath: /var/run/shared-tmpfs
name: shared-tmpfs
- name: csi-attacher
image: k8s.gcr.io/sig-storage/csi-attacher:v4.2.0
args:
- --csi-address=/var/run/shared-tmpfs/csi.sock
- --timeout=120s
- --leader-election=true
- --leader-election-namespace=oci-csi
volumeMounts:
- name: config
mountPath: /etc/oci/
readOnly: true
- mountPath: /var/run/shared-tmpfs
name: shared-tmpfs
- name: csi-resizer
image: k8s.gcr.io/sig-storage/csi-resizer:v1.7.0
args:
- --csi-address=/var/run/shared-tmpfs/csi.sock
- --leader-election
imagePullPolicy: "IfNotPresent"
volumeMounts:
- mountPath: /var/run/shared-tmpfs
name: shared-tmpfs
- name: oci-csi-controller-driver
args:
- --endpoint=unix://var/run/shared-tmpfs/csi.sock
- --fss-csi-endpoint=unix://var/run/shared-tmpfs/csi-fss.sock
command:
- /usr/local/bin/oci-csi-controller-driver
image: ghcr.io/oracle/cloud-provider-oci:v1.25.0
imagePullPolicy: IfNotPresent
volumeMounts:
- name: config
mountPath: /etc/oci/
readOnly: true
- name: kubernetes
mountPath: /etc/kubernetes
readOnly: true
- mountPath: /var/run/shared-tmpfs
name: shared-tmpfs
volumes:
- name: config
secret:
secretName: oci-volume-provisioner
- name: kubernetes
hostPath:
path: /etc/kubernetes
- name: shared-tmpfs
emptyDir: {}
dnsPolicy: ClusterFirst
hostNetwork: true
imagePullSecrets:
- name: image-pull-secret
restartPolicy: Always
schedulerName: default-scheduler
serviceAccount: csi-oci-node-sa
serviceAccountName: csi-oci-node-sa
terminationGracePeriodSeconds: 30
tolerations:
- operator: Exists
---
# oci-csi-03-fss-driver.yaml
apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: fss.csi.oraclecloud.com
spec:
attachRequired: false
podInfoOnMount: false
---
# oci-csi-04-bv-driver.yaml
apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: blockvolume.csi.oraclecloud.com
spec:
fsGroupPolicy: File
---
# oci-csi-05-iscsiadm.yaml
kind: ConfigMap
apiVersion: v1
metadata:
name: oci-csi-iscsiadm
namespace: oci-csi
data:
iscsiadm: |
#!/bin/sh
if [ -x /host/sbin/iscsiadm ]; then
chroot /host /sbin/iscsiadm "$@"
elif [ -x /host/usr/local/sbin/iscsiadm ]; then
chroot /host /usr/local/sbin/iscsiadm "$@"
elif [ -x /host/bin/iscsiadm ]; then
chroot /host /bin/iscsiadm "$@"
elif [ -x /host/usr/local/bin/iscsiadm ]; then
chroot /host /usr/local/bin/iscsiadm "$@"
else
chroot /host iscsiadm "$@"
fi
---
# oci-csi-06-fss-csi.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: oci-fss-csi
namespace: oci-csi
data:
mount: |-
#!/bin/sh
if [ -x /sbin/mount ]; then
chroot /host mount "$@"
elif [ -x /usr/local/sbin/mount ]; then
chroot /host mount "$@"
elif [ -x /usr/sbin/mount ]; then
chroot /host mount "$@"
elif [ -x /usr/local/bin/mount ]; then
chroot /host mount "$@"
else
chroot /host mount "$@"
fi
umount: |-
#!/bin/sh
if [ -x /sbin/umount ]; then
chroot /host umount "$@"
elif [ -x /usr/local/sbin/umount ]; then
chroot /host umount "$@"
elif [ -x /usr/sbin/umount ]; then
chroot /host umount "$@"
elif [ -x /usr/local/bin/umount ]; then
chroot /host umount "$@"
else
chroot /host umount "$@"
fi
umount.oci-fss: |-
#!/bin/sh
if [ -x /sbin/umount-oci-fss ]; then
chroot /host umount.oci-fss "$@"
elif [ -x /usr/local/sbin/umount-oci-fss ]; then
chroot /host umount.oci-fss "$@"
elif [ -x /usr/sbin/umount-oci-fss ]; then
chroot /host umount.oci-fss "$@"
elif [ -x /usr/local/bin/umount-oci-fss ]; then
chroot /host umount.oci-fss "$@"
else
chroot /host umount.oci-fss "$@"
fi
---
# oci-csi-07-node-driver.yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
annotations:
deprecated.daemonset.template.generation: "1"
generation: 1
name: csi-oci-node
namespace: oci-csi
spec:
revisionHistoryLimit: 10
selector:
matchLabels:
app: csi-oci-node
template:
metadata:
creationTimestamp: null
labels:
app: csi-oci-node
role: csi-oci
spec:
nodeSelector:
node-role.kubernetes.io/worker: ""
containers:
- name: oci-csi-node-driver
args:
- --v=2
- --endpoint=unix:///csi/csi.sock
- --nodeid=$(KUBE_NODE_NAME)
- --loglevel=debug
- --fss-endpoint=unix:///fss/csi.sock
command:
- /usr/local/bin/oci-csi-node-driver
env:
- name: KUBE_NODE_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
- name: PATH
value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/host/usr/bin:/host/sbin
image: ghcr.io/oracle/cloud-provider-oci:v1.25.0
securityContext:
privileged: true
volumeMounts:
- mountPath: /csi
name: plugin-dir
- mountPath: /fss
name: fss-plugin-dir
- mountPath: /var/lib/kubelet
mountPropagation: Bidirectional
name: pods-mount-dir
- mountPath: /dev
name: device-dir
- mountPath: /host
name: host-root
- mountPath: /sbin/iscsiadm
name: chroot-iscsiadm
subPath: iscsiadm
- mountPath: /host/var/lib/kubelet
mountPropagation: Bidirectional
name: encrypt-pods-mount-dir
- mountPath: /sbin/umount.oci-fss
name: fss-driver-mounts
subPath: umount.oci-fss
- mountPath: /sbin/umount
name: fss-driver-mounts
subPath: umount
- mountPath: /sbin/mount
name: fss-driver-mounts
subPath: mount
- name: csi-node-registrar
args:
- --csi-address=/csi/csi.sock
- --kubelet-registration-path=/var/lib/kubelet/plugins/blockvolume.csi.oraclecloud.com/csi.sock
image: k8s.gcr.io/sig-storage/csi-node-driver-registrar:v2.5.1
securityContext:
privileged: true
lifecycle:
preStop:
exec:
command:
- /bin/sh
- -c
- rm -rf /registration/blockvolume.csi.oraclecloud.com /registration/blockvolume.csi.oraclecloud.com-reg.sock
volumeMounts:
- mountPath: /csi
name: plugin-dir
- mountPath: /registration
name: registration-dir
- name: csi-node-registrar-fss
args:
- --csi-address=/fss/csi.sock
- --kubelet-registration-path=/var/lib/kubelet/plugins/fss.csi.oraclecloud.com/csi.sock
image: k8s.gcr.io/sig-storage/csi-node-driver-registrar:v2.5.0
securityContext:
privileged: true
lifecycle:
preStop:
exec:
command:
- /bin/sh
- -c
- rm -rf /registration/fss.csi.oraclecloud.com /registration/fss.csi.oraclecloud.com-reg.sock
volumeMounts:
- mountPath: /fss
name: fss-plugin-dir
- mountPath: /registration
name: registration-dir
dnsPolicy: ClusterFirst
hostNetwork: true
restartPolicy: Always
schedulerName: default-scheduler
serviceAccount: csi-oci-node-sa
serviceAccountName: csi-oci-node-sa
terminationGracePeriodSeconds: 30
tolerations:
- operator: Exists
volumes:
- hostPath:
path: /var/lib/kubelet/plugins_registry/
type: DirectoryOrCreate
name: registration-dir
- hostPath:
path: /var/lib/kubelet/plugins/blockvolume.csi.oraclecloud.com
type: DirectoryOrCreate
name: plugin-dir
- hostPath:
path: /var/lib/kubelet/plugins/fss.csi.oraclecloud.com
type: DirectoryOrCreate
name: fss-plugin-dir
- hostPath:
path: /var/lib/kubelet
type: Directory
name: pods-mount-dir
- hostPath:
path: /var/lib/kubelet
type: Directory
name: encrypt-pods-mount-dir
- hostPath:
path: /dev
type: ""
name: device-dir
- hostPath:
path: /
type: Directory
name: host-root
- configMap:
name: oci-csi-iscsiadm
defaultMode: 0755
name: chroot-iscsiadm
- configMap:
name: oci-fss-csi
defaultMode: 0755
name: fss-driver-mounts
updateStrategy:
rollingUpdate:
maxUnavailable: 1
type: RollingUpdate
---
# oci-csi-08-node-rbac-sa.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: csi-oci-node-sa
namespace: oci-csi
---
# oci-csi-09-node-rbac-cr.yaml
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-oci
namespace: oci-csi
rules:
- apiGroups: [""]
resources: ["events"]
verbs: ["get", "list", "watch", "create", "update", "patch"]
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get", "list", "watch"]
- apiGroups: ["volume.oci.oracle.com"]
resources: ["blockscsiinfos"]
verbs: ["get", "list", "watch", "create", "delete", "update", "patch"]
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["get", "list", "watch", "create", "delete", "patch"]
- apiGroups: [""]
resources: ["persistentvolumeclaims"]
verbs: ["get", "list", "watch", "update", "create"]
- apiGroups: ["storage.k8s.io"]
resources: ["storageclasses", "volumeattachments", "volumeattachments/status", "csinodes"]
verbs: ["get", "list", "watch", "patch"]
- apiGroups: ["coordination.k8s.io"]
resources: ["leases"]
verbs: ["get", "list", "watch", "create", "delete", "update", "patch"]
- apiGroups: [""]
resources: ["endpoints"]
verbs: ["get", "watch", "create", "update"]
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["persistentvolumeclaims/status"]
verbs: ["patch"]
---
# oci-csi-10-node-rbac-crb.yaml
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-oci-binding
subjects:
- kind: ServiceAccount
name: csi-oci-node-sa
namespace: oci-csi
roleRef:
kind: ClusterRole
name: csi-oci
apiGroup: rbac.authorization.k8s.io
---
# oci-csi-11-storage-class-bv.yaml
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: oci-bv
provisioner: blockvolume.csi.oraclecloud.com
volumeBindingMode: WaitForFirstConsumer
allowVolumeExpansion: true
reclaimPolicy: Delete
---
# oci-csi-12-storage-class-bv-enc.yaml
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: oci-bv-encrypted
provisioner: blockvolume.csi.oraclecloud.com
parameters:
attachment-type: "paravirtualized"
reclaimPolicy: Delete
volumeBindingMode: WaitForFirstConsumer
allowVolumeExpansion: true
---