Skip to content

Commit e11d83d

Browse files
committed
openstack-manila: Consume CA cert from credentials secret (assets)
Again, do what we already did for openstack-cinder but for openstack-manila. Like the openstack-cinder change, we continue to allow consuming from the old location to ease upgrades. It's worth highlighting that this is a nice little step towards having the Manila CSI driver and controller source their credentials from a 'clouds.yaml' rather than a 'cloud.conf' file, which would let us remove a lot of logic currently found in the operator. Completing that effort is a job best left to another day though so a TODO is included for now. Changes to the generated assets are not included here to keep things clear. Those will be added in a follow-up changes. Signed-off-by: Stephen Finucane <[email protected]>
1 parent 9d1fcea commit e11d83d

File tree

7 files changed

+85
-32
lines changed

7 files changed

+85
-32
lines changed

assets/overlays/openstack-manila/generated/hypershift/controller.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,10 @@ spec:
132132
volumeMounts:
133133
- mountPath: /plugin
134134
name: socket-dir
135+
- mountPath: /etc/openstack
136+
name: cloud-credentials
135137
- mountPath: /etc/kubernetes/static-pod-resources/configmaps/cloud-config
136-
name: cacert
138+
name: legacy-cacert
137139
- args:
138140
- --nodeid=$(NODE_ID)
139141
- --endpoint=unix://plugin/csi-nfs.sock
@@ -367,13 +369,19 @@ spec:
367369
- name: metrics-serving-cert
368370
secret:
369371
secretName: manila-csi-driver-controller-metrics-serving-cert
372+
- name: cloud-credentials
373+
secret:
374+
items:
375+
- key: cacert
376+
path: ca.crt
377+
secretName: manila-cloud-credentials
370378
- configMap:
371379
items:
372380
- key: ca-bundle.pem
373381
path: ca-bundle.pem
374382
name: openstack-cloud-config
375383
optional: true
376-
name: cacert
384+
name: legacy-cacert
377385
- name: hosted-kubeconfig
378386
secret:
379387
defaultMode: 420

assets/overlays/openstack-manila/generated/hypershift/node.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,10 @@ spec:
8181
name: plugin-dir
8282
- mountPath: /var/lib/kubelet/plugins/csi-nfsplugin
8383
name: fwd-plugin-dir
84+
- mountPath: /etc/openstack
85+
name: cloud-credentials
8486
- mountPath: /etc/kubernetes/static-pod-resources/configmaps/cloud-config
85-
name: cacert
87+
name: legacy-cacert
8688
- mountPath: /etc/selinux
8789
name: etc-selinux
8890
- mountPath: /sys/fs
@@ -188,13 +190,19 @@ spec:
188190
path: /var/lib/kubelet/plugins/csi-nfsplugin
189191
type: DirectoryOrCreate
190192
name: fwd-plugin-dir
193+
- name: cloud-credentials
194+
secret:
195+
items:
196+
- key: cacert
197+
path: ca.crt
198+
secretName: manila-cloud-credentials
191199
- configMap:
192200
items:
193201
- key: ca-bundle.pem
194202
path: ca-bundle.pem
195203
name: cloud-provider-config
196204
optional: true
197-
name: cacert
205+
name: legacy-cacert
198206
updateStrategy:
199207
rollingUpdate:
200208
maxUnavailable: 10%

assets/overlays/openstack-manila/generated/standalone/controller.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,10 @@ spec:
102102
volumeMounts:
103103
- mountPath: /plugin
104104
name: socket-dir
105+
- mountPath: /etc/openstack
106+
name: cloud-credentials
105107
- mountPath: /etc/kubernetes/static-pod-resources/configmaps/cloud-config
106-
name: cacert
108+
name: legacy-cacert
107109
- args:
108110
- --nodeid=$(NODE_ID)
109111
- --endpoint=unix://plugin/csi-nfs.sock
@@ -316,10 +318,16 @@ spec:
316318
- name: metrics-serving-cert
317319
secret:
318320
secretName: manila-csi-driver-controller-metrics-serving-cert
321+
- name: cloud-credentials
322+
secret:
323+
items:
324+
- key: cacert
325+
path: ca.crt
326+
secretName: manila-cloud-credentials
319327
- configMap:
320328
items:
321329
- key: ca-bundle.pem
322330
path: ca-bundle.pem
323331
name: cloud-provider-config
324332
optional: true
325-
name: cacert
333+
name: legacy-cacert

assets/overlays/openstack-manila/generated/standalone/node.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,10 @@ spec:
8181
name: plugin-dir
8282
- mountPath: /var/lib/kubelet/plugins/csi-nfsplugin
8383
name: fwd-plugin-dir
84+
- mountPath: /etc/openstack
85+
name: cloud-credentials
8486
- mountPath: /etc/kubernetes/static-pod-resources/configmaps/cloud-config
85-
name: cacert
87+
name: legacy-cacert
8688
- mountPath: /etc/selinux
8789
name: etc-selinux
8890
- mountPath: /sys/fs
@@ -188,13 +190,19 @@ spec:
188190
path: /var/lib/kubelet/plugins/csi-nfsplugin
189191
type: DirectoryOrCreate
190192
name: fwd-plugin-dir
193+
- name: cloud-credentials
194+
secret:
195+
items:
196+
- key: cacert
197+
path: ca.crt
198+
secretName: manila-cloud-credentials
191199
- configMap:
192200
items:
193201
- key: ca-bundle.pem
194202
path: ca-bundle.pem
195203
name: cloud-provider-config
196204
optional: true
197-
name: cacert
205+
name: legacy-cacert
198206
updateStrategy:
199207
rollingUpdate:
200208
maxUnavailable: 10%

assets/overlays/openstack-manila/patches/controller_add_driver.yaml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ spec:
7474
volumeMounts:
7575
- name: socket-dir
7676
mountPath: /plugin
77-
- name: cacert
77+
- name: cloud-credentials
78+
mountPath: /etc/openstack
79+
- name: legacy-cacert
7880
mountPath: /etc/kubernetes/static-pod-resources/configmaps/cloud-config
7981
resources:
8082
requests:
@@ -105,12 +107,20 @@ spec:
105107
volumes:
106108
- name: socket-dir
107109
emptyDir: {}
108-
- name: cacert
109-
# If present, extract ca-bundle.pem to
110-
# /etc/kubernetes/static-pod-resources/configmaps/cloud-config
110+
- name: cloud-credentials
111+
secret:
112+
secretName: manila-cloud-credentials
113+
# TODO(stephenfin): We should also mount the clouds.yaml file
114+
# here and start consuming that rather than converting it into
115+
# the cloud.conf format
116+
items:
117+
- key: cacert
118+
path: ca.crt
119+
- name: legacy-cacert
111120
# Let the pod start when the ConfigMap does not exist or the certificate
112121
# is not preset there. The certificate file will be created once the
113-
# ConfigMap is created / the cerificate is added to it.
122+
# ConfigMap is created / the certificate is added to it.
123+
# TODO(stephenfin): Remove in 4.20
114124
configMap:
115125
name: cloud-provider-config
116126
items:

assets/overlays/openstack-manila/patches/controller_rename_config_map.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ spec:
22
template:
33
spec:
44
volumes:
5-
- configMap:
6-
items:
7-
- key: ca-bundle.pem
8-
path: ca-bundle.pem
9-
name: openstack-cloud-config
10-
optional: true
11-
name: cacert
5+
- name: legacy-cacert
6+
configMap:
7+
items:
8+
- key: ca-bundle.pem
9+
path: ca-bundle.pem
10+
name: openstack-cloud-config
11+
optional: true

assets/overlays/openstack-manila/patches/node_add_driver.yaml

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ spec:
6161
mountPath: /var/lib/kubelet/plugins/manila.csi.openstack.org
6262
- name: fwd-plugin-dir
6363
mountPath: /var/lib/kubelet/plugins/csi-nfsplugin
64-
- name: cacert
64+
- name: cloud-credentials
65+
mountPath: /etc/openstack
66+
- name: legacy-cacert
6567
mountPath: /etc/kubernetes/static-pod-resources/configmaps/cloud-config
6668
- name: etc-selinux
6769
mountPath: /etc/selinux
@@ -98,17 +100,6 @@ spec:
98100
hostPath:
99101
path: /var/lib/kubelet/plugins/csi-nfsplugin
100102
type: DirectoryOrCreate
101-
- name: cacert
102-
# Extract ca-bundle.pem to /etc/kubernetes/static-pod-resources/configmaps/cloud-config if present.
103-
# Let the pod start when the ConfigMap does not exist or the certificate
104-
# is not preset there. The certificate file will be created once the
105-
# ConfigMap is created / the cerificate is added to it.
106-
configMap:
107-
name: cloud-provider-config
108-
items:
109-
- key: ca-bundle.pem
110-
path: ca-bundle.pem
111-
optional: true
112103
- name: etc-selinux
113104
hostPath:
114105
path: /etc/selinux
@@ -117,3 +108,23 @@ spec:
117108
hostPath:
118109
path: /sys/fs
119110
type: Directory
111+
- name: cloud-credentials
112+
secret:
113+
secretName: manila-cloud-credentials
114+
# TODO(stephenfin): We should also mount the clouds.yaml file
115+
# here and start consuming that rather than converting it into
116+
# the cloud.conf format
117+
items:
118+
- key: cacert
119+
path: ca.crt
120+
- name: legacy-cacert
121+
# Let the pod start when the ConfigMap does not exist or the certificate
122+
# is not preset there. The certificate file will be created once the
123+
# ConfigMap is created / the certificate is added to it.
124+
# TODO(stephenfin): Remove in 4.20
125+
configMap:
126+
name: cloud-provider-config
127+
items:
128+
- key: ca-bundle.pem
129+
path: ca-bundle.pem
130+
optional: true

0 commit comments

Comments
 (0)