1+ {{- if or (not .Values.splitMode.enabled) (eq .Values.splitMode.type "management") }}
12kind : Deployment
23apiVersion : apps/v1
34metadata :
@@ -10,7 +11,7 @@ metadata:
1011 {{- toYaml . | nindent 4 }}
1112 {{- end }}
1213spec :
13- replicas : {{ .Values.csi.plugin.controllerPlugin.replicas }}
14+ replicas : {{ and .Values.splitMode.enabled (eq .Values.splitMode.type "management") | ternary .Values.splitMode.replicas .Values.csi.plugin.controllerPlugin.replicas }}
1415 strategy :
1516 type : {{ .Values.csi.plugin.controllerPlugin.strategy.type }}
1617{{- if eq .Values.csi.plugin.controllerPlugin.strategy.type "RollingUpdate" }}
2829 annotations :
2930 {{- include "cinder-csi.controllerplugin.podAnnotations" . | nindent 8 }}
3031 spec :
31- serviceAccount : csi-cinder-controller-sa
32+ {{- if .Values.splitMode.enabled }}
33+ automountServiceAccountToken : false
34+ {{- else }}
35+ serviceAccountName : csi-cinder-controller-sa
36+ {{- end }}
3237 securityContext :
3338 {{- toYaml .Values.csi.plugin.controllerPlugin.podSecurityContext | nindent 8 }}
3439 containers :
4348 - " --timeout={{ .Values.timeout }}"
4449 - " --leader-election=true"
4550 - " --default-fstype=ext4"
51+ {{- if and .Values.splitMode.enabled (eq .Values.splitMode.type "management") }}
52+ - " --kubeconfig=/etc/kubernetes/kubeconfig"
53+ {{- end }}
4654 {{- if .Values.csi.attacher.extraArgs }}
4755 {{- with .Values.csi.attacher.extraArgs }}
4856 {{- tpl . $ | trim | nindent 12 }}
5765 volumeMounts :
5866 - name : socket-dir
5967 mountPath : /var/lib/csi/sockets/pluginproxy/
68+ {{- if and .Values.splitMode.enabled (eq .Values.splitMode.type "management") }}
69+ - name : kubeconfig
70+ mountPath : /etc/kubernetes
71+ readOnly : true
72+ {{- end }}
6073 resources : {{ toYaml .Values.csi.attacher.resources | nindent 12 }}
6174 - name : csi-provisioner
6275 securityContext :
7184 - " --default-fstype=ext4"
7285 - " --feature-gates=Topology={{ .Values.csi.provisioner.topology }}"
7386 - " --extra-create-metadata"
87+ {{- if and .Values.splitMode.enabled (eq .Values.splitMode.type "management") }}
88+ - " --kubeconfig=/etc/kubernetes/kubeconfig"
89+ {{- end }}
7490 {{- if .Values.csi.provisioner.extraArgs }}
7591 {{- with .Values.csi.provisioner.extraArgs }}
7692 {{- tpl . $ | trim | nindent 12 }}
@@ -85,6 +101,11 @@ spec:
85101 volumeMounts :
86102 - name : socket-dir
87103 mountPath : /var/lib/csi/sockets/pluginproxy/
104+ {{- if and .Values.splitMode.enabled (eq .Values.splitMode.type "management") }}
105+ - name : kubeconfig
106+ mountPath : /etc/kubernetes
107+ readOnly : true
108+ {{- end }}
88109 resources : {{ toYaml .Values.csi.provisioner.resources | nindent 12 }}
89110 - name : csi-snapshotter
90111 securityContext :
96117 - " --csi-address=$(ADDRESS)"
97118 - " --timeout={{ .Values.timeout }}"
98119 - " --leader-election=true"
120+ {{- if and .Values.splitMode.enabled (eq .Values.splitMode.type "management") }}
121+ - " --kubeconfig=/etc/kubernetes/kubeconfig"
122+ {{- end }}
99123 {{- if .Values.csi.snapshotter.extraArgs }}
100124 {{- with .Values.csi.snapshotter.extraArgs }}
101125 {{- tpl . $ | trim | nindent 12 }}
@@ -110,6 +134,11 @@ spec:
110134 volumeMounts :
111135 - mountPath : /var/lib/csi/sockets/pluginproxy/
112136 name : socket-dir
137+ {{- if and .Values.splitMode.enabled (eq .Values.splitMode.type "management") }}
138+ - name : kubeconfig
139+ mountPath : /etc/kubernetes
140+ readOnly : true
141+ {{- end }}
113142 resources : {{ toYaml .Values.csi.snapshotter.resources | nindent 12 }}
114143 - name : csi-resizer
115144 securityContext :
@@ -122,6 +151,9 @@ spec:
122151 - " --timeout={{ .Values.timeout }}"
123152 - " --handle-volume-inuse-error=false"
124153 - " --leader-election=true"
154+ {{- if and .Values.splitMode.enabled (eq .Values.splitMode.type "management") }}
155+ - " --kubeconfig=/etc/kubernetes/kubeconfig"
156+ {{- end }}
125157 {{- if .Values.csi.resizer.extraArgs }}
126158 {{- with .Values.csi.resizer.extraArgs }}
127159 {{- tpl . $ | trim | nindent 12 }}
@@ -136,6 +168,11 @@ spec:
136168 volumeMounts :
137169 - name : socket-dir
138170 mountPath : /var/lib/csi/sockets/pluginproxy/
171+ {{- if and .Values.splitMode.enabled (eq .Values.splitMode.type "management") }}
172+ - name : kubeconfig
173+ mountPath : /etc/kubernetes
174+ readOnly : true
175+ {{- end }}
139176 resources : {{ toYaml .Values.csi.resizer.resources | nindent 12 }}
140177 - name : liveness-probe
141178 securityContext :
@@ -219,7 +256,12 @@ spec:
219256 volumeMounts :
220257 - name : socket-dir
221258 mountPath : /csi
222- {{- with .Values.csi.plugin.volumeMounts }}
259+ {{- if .Values.secret.enabled }}
260+ - name : cloud-config
261+ mountPath : {{ .Values.secret.path }}
262+ readOnly : true
263+ {{- end }}
264+ {{- with .Values.splitMode.enabled | ternary .Values.splitMode.volumeMounts .Values.csi.plugin.volumeMounts }}
223265 {{- toYaml . | nindent 12 }}
224266 {{- end }}
225267 resources : {{ toYaml .Values.csi.plugin.resources | nindent 12 }}
@@ -235,11 +277,19 @@ spec:
235277 hostPath :
236278 path : /etc/config
237279 {{- end }}
238- {{- with .Values.csi.plugin.volumes }}
280+ {{- with .Values.splitMode.enabled | ternary .Values.splitMode.volumes .Values. csi.plugin.volumes }}
239281 {{- toYaml . | nindent 8 }}
240282 {{- end }}
283+ {{- if and .Values.splitMode.enabled (eq .Values.splitMode.type "management") }}
284+ - name : kubeconfig
285+ secret :
286+ secretName : {{ .Values.splitMode.kubeconfig.secretName }}
287+ items :
288+ - key : {{ .Values.splitMode.kubeconfig.secretKey }}
289+ path : kubeconfig
290+ {{- end }}
241291 affinity : {{ toYaml .Values.csi.plugin.controllerPlugin.affinity | nindent 8 }}
242- nodeSelector : {{ toYaml .Values.csi.plugin.controllerPlugin.nodeSelector | nindent 8 }}
292+ nodeSelector : {{ toYaml (and .Values.splitMode.enabled (eq .Values.splitMode.type "management") | ternary .Values.splitMode.nodeSelector .Values. csi.plugin.controllerPlugin.nodeSelector) | nindent 8 }}
243293 tolerations : {{ toYaml .Values.csi.plugin.controllerPlugin.tolerations | nindent 8 }}
244294 {{- with .Values.csi.plugin.controllerPlugin.hostAliases }}
245295 hostAliases :
@@ -252,3 +302,4 @@ spec:
252302 imagePullSecrets :
253303 {{- toYaml . | nindent 8 }}
254304 {{- end }}
305+ {{- end }}
0 commit comments