Skip to content

Commit 7853ba8

Browse files
Update openstack-cinder-csi helm chart for multi cloud support (#2681)
* allow helm chart to accept different extraArgs for nodePlugin and controllerPlugin + documentation * add extraRbac for resizer and snapshotter * code review --------- Co-authored-by: pýrus <[email protected]>
1 parent 71f829a commit 7853ba8

File tree

6 files changed

+69
-13
lines changed

6 files changed

+69
-13
lines changed

charts/cinder-csi-plugin/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v1
22
appVersion: v1.32.0
33
description: Cinder CSI Chart for OpenStack
44
name: openstack-cinder-csi
5-
version: 2.33.0-alpha.0
5+
version: 2.33.0-alpha.1
66
home: https://github.com/kubernetes/cloud-provider-openstack
77
icon: https://github.com/kubernetes/kubernetes/blob/master/logo/logo.png
88
maintainers:

charts/cinder-csi-plugin/templates/controllerplugin-deployment.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,11 @@ spec:
183183
{{- tpl . $ | trim | nindent 12 }}
184184
{{- end }}
185185
{{- end }}
186+
{{- if .Values.csi.plugin.controllerPlugin.extraArgs }}
187+
{{- with .Values.csi.plugin.controllerPlugin.extraArgs }}
188+
{{- tpl . $ | trim | nindent 12 }}
189+
{{- end }}
190+
{{- end }}
186191
env:
187192
- name: CSI_ENDPOINT
188193
value: unix://csi/csi.sock

charts/cinder-csi-plugin/templates/controllerplugin-rbac.yaml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,6 @@ rules:
9797
- apiGroups: [""]
9898
resources: ["events"]
9999
verbs: ["list", "watch", "create", "update", "patch"]
100-
# Secret permission is optional.
101-
# Enable it if your driver needs secret.
102-
# For example, `csi.storage.k8s.io/snapshotter-secret-name` is set in VolumeSnapshotClass.
103-
# See https://kubernetes-csi.github.io/docs/secrets-and-credentials.html for more details.
104-
# - apiGroups: [""]
105-
# resources: ["secrets"]
106-
# verbs: ["get", "list"]
107100
- apiGroups: ["snapshot.storage.k8s.io"]
108101
resources: ["volumesnapshotclasses"]
109102
verbs: ["get", "list", "watch"]
@@ -116,6 +109,9 @@ rules:
116109
- apiGroups: ["coordination.k8s.io"]
117110
resources: ["leases"]
118111
verbs: ["get", "watch", "list", "delete", "update", "create"]
112+
{{- with .Values.csi.snapshotter.extraRbac }}
113+
{{- toYaml . | nindent 2 }}
114+
{{- end }}
119115
---
120116
kind: ClusterRoleBinding
121117
apiVersion: rbac.authorization.k8s.io/v1
@@ -135,11 +131,6 @@ apiVersion: rbac.authorization.k8s.io/v1
135131
metadata:
136132
name: csi-resizer-role
137133
rules:
138-
# The following rule should be uncommented for plugins that require secrets
139-
# for provisioning.
140-
# - apiGroups: [""]
141-
# resources: ["secrets"]
142-
# verbs: ["get", "list", "watch"]
143134
- apiGroups: [""]
144135
resources: ["persistentvolumes"]
145136
verbs: ["get", "list", "watch", "patch"]
@@ -158,6 +149,9 @@ rules:
158149
- apiGroups: ["coordination.k8s.io"]
159150
resources: ["leases"]
160151
verbs: ["get", "watch", "list", "delete", "update", "create"]
152+
{{- with .Values.csi.resizer.extraRbac }}
153+
{{- toYaml . | nindent 2 }}
154+
{{- end }}
161155
---
162156
kind: ClusterRoleBinding
163157
apiVersion: rbac.authorization.k8s.io/v1

charts/cinder-csi-plugin/templates/nodeplugin-daemonset.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ spec:
9696
{{- tpl . $ | trim | nindent 12 }}
9797
{{- end }}
9898
{{- end }}
99+
{{- if .Values.csi.plugin.nodePlugin.extraArgs }}
100+
{{- with .Values.csi.plugin.nodePlugin.extraArgs }}
101+
{{- tpl . $ | trim | nindent 12 }}
102+
{{- end }}
103+
{{- end }}
99104
env:
100105
- name: CSI_ENDPOINT
101106
value: unix://csi/csi.sock

charts/cinder-csi-plugin/values.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ csi:
3030
resources: {}
3131
extraArgs: {}
3232
extraEnv: []
33+
# Secret permission is optional.
34+
# Enable it if your driver needs secret.
35+
# For example, `csi.storage.k8s.io/snapshotter-secret-name` is set in VolumeSnapshotClass.
36+
# See https://kubernetes-csi.github.io/docs/secrets-and-credentials.html for more details.
37+
extraRbac: {}
38+
# - apiGroups: [""]
39+
# resources: ["secrets"]
40+
# verbs: ["get", "list"]
3341
resizer:
3442
image:
3543
repository: registry.k8s.io/sig-storage/csi-resizer
@@ -38,6 +46,12 @@ csi:
3846
resources: {}
3947
extraArgs: {}
4048
extraEnv: []
49+
# The following rule should be uncommented for plugins that require secrets
50+
# for provisioning.
51+
extraRbac: {}
52+
# - apiGroups: [""]
53+
# resources: ["secrets"]
54+
# verbs: ["get", "list", "watch"]
4155
livenessprobe:
4256
image:
4357
repository: registry.k8s.io/sig-storage/livenessprobe
@@ -92,6 +106,7 @@ csi:
92106
tolerations:
93107
- operator: Exists
94108
kubeletDir: /var/lib/kubelet
109+
extraArgs: {}
95110
# Allow for specifying internal IP addresses for multiple hostnames
96111
# hostAliases:
97112
# - ip: "10.0.0.1"
@@ -130,6 +145,7 @@ csi:
130145
affinity: {}
131146
nodeSelector: {}
132147
tolerations: []
148+
extraArgs: {}
133149
# Allow for specifying internal IP addresses for multiple hostnames
134150
# hostAliases:
135151
# - ip: "10.0.0.1"

docs/cinder-csi-plugin/multi-region-clouds.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,3 +318,39 @@ spec:
318318
...
319319
```
320320

321+
### When Using the cinder-csi-plugin Helm Chart
322+
323+
When running the `cinder-csi-plugin` in a multi-region setup, you need to specify different `extraArgs` for the `cinder-csi-plugin` containers in both the Deployment and the DaemonSet.
324+
325+
When using the Helm chart, set the different `extraArgs` using `plugin.nodePlugin.extraArgs` and `plugin.controllerPlugin.extraArgs`.
326+
327+
If you set the `extraArgs` in `plugin.extraArgs`, the same arguments will be applied to both the Deployment and the DaemonSet `cinder-csi-plugin` containers.
328+
329+
You will still need to manually create additional DaemonSets for your extra regions.
330+
331+
```yaml
332+
nodePlugin:
333+
extraArgs: |-
334+
- --cloud-name=region-one
335+
- --additional-topology
336+
- topology.kubernetes.io/region=region-one
337+
controllerPlugin:
338+
extraArgs: |-
339+
- --cloud-name=region-one
340+
- --cloud-name=region-two
341+
```
342+
343+
In addition, if you use the `resizer` and the `snapshotter`, you will need them to be able to read the secrets you defined in the storage class' annotations in order to determine which cloud to address. You will need to add some `extraRbac` in YAML format, like this:
344+
345+
```yaml
346+
snapshotter:
347+
extraRbac:
348+
- apiGroups: [""]
349+
resources: ["secrets"]
350+
verbs: ["get", "list"]
351+
resizer:
352+
extraRbac:
353+
- apiGroups: [""]
354+
resources: ["secrets"]
355+
verbs: ["get", "list", "watch"]
356+
```

0 commit comments

Comments
 (0)