Skip to content

Commit c2855e6

Browse files
authored
Merge pull request #11 from SovereignCloudStack/feat/fixup-csicinder
Work around cinder-CSI cacert issues.
2 parents af6124c + 9725b38 commit c2855e6

4 files changed

Lines changed: 77 additions & 2 deletions

File tree

09-fixup-cinder.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
#
3+
# 09-fixup-cinder.sh: Patch Cinder-CSI config path from /etc/kubernetes/
4+
# de
5+
# to /etc/config/, so the reference ca-file=/etc/config/cacert in the
6+
# file cloud.conf points to an existing place again.
7+
#
8+
# This is required in case we use a custom CA file and inject it.
9+
#
10+
# (c) Kurt Garloff <s7n@garloff.de>, 5/2025
11+
# SPDX-License-Identifier: CC-BY-SA-4.0
12+
set -e
13+
THISDIR=$(dirname 0)
14+
# We need settings
15+
if test -n "$1"; then
16+
SET="$1"
17+
else
18+
if test -e cluster-settings.env; then SET=cluster-settings.env;
19+
else echo "You need to pass a cluster-settings.env file as parameter"; exit 1
20+
fi
21+
fi
22+
# Read settings -- make sure you can trust it
23+
source "$SET"
24+
# Do this on the workload cluster, ensure we have a config
25+
clusterctl get kubeconfig -n $CS_NAMESPACE $CL_NAME > ~/.kube/config-$CS_NAMESPACE.$CL_NAME
26+
export KUBECONFIG=~/.kube/config-$CS_NAMESPACE.$CL_NAME
27+
# Get cinder-csi-controllerplugin deployment and patch it
28+
kubectl get -n kube-system deployment openstack-cinder-csi-controllerplugin -o yaml > ~/tmp/cinder-csi-controllerplugin.yaml
29+
patch ~/tmp/cinder-csi-controllerplugin.yaml <$THISDIR/csi-cinder-controller-deployment.diff
30+
kubectl get -n kube-system daemonset openstack-cinder-csi-nodeplugin -o yaml > ~/tmp/cinder-csi-nodeplugin.yaml
31+
patch ~/tmp/cinder-csi-nodeplugin.yaml <$THISDIR/csi-cinder-nodeplugin-daemonset.diff
32+
kubectl apply -f ~/tmp/cinder-csi-controllerplugin.yaml
33+
kubectl apply -f ~/tmp/cinder-csi-nodeplugin.yaml
34+

README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,14 @@ copy, fill it in, and pass it to the scripts.
4242

4343
* 17-delete-cluster.sh: Remove cluster again.
4444

45-
46-
45+
### CSI Cinder fixup
46+
The `cloud.conf` generated by the helm openstack-csp-helper in step 04
47+
references a `ca-file=/etc/config/cacert` if a custom CA file is being
48+
detected. This works for the OpenStack Cloud Controller Manager (OCCM)
49+
that is deployed into the workload cluster, but not for the CSI Cinder
50+
driver which mounts the `cloud-config` secrets at `/etc/kubernetes`
51+
and not `/etc/config/` by default, so the `ca-file=` reference points
52+
to a non-existing file, see [ClusterStacks issue #188](https://github.com/SovereignCloudStack/cluster-stacks/issues/188).
53+
This results in a `CrashLoopBackup` state for
54+
the openstack-cinder-csi-* pods in the workload cluster. Until this
55+
is fixed up upstream, it can be patched using the `09-fixup-cinder.sh`.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--- cinder-controller.old.yaml 2025-05-21 15:06:02.729428914 +0000
2+
+++ cinder-controller.yaml 2025-05-21 15:14:06.215467738 +0000
3+
@@ -147,5 +147,5 @@ spec:
4+
value: unix://csi/csi.sock
5+
- name: CLOUD_CONFIG
6+
- value: /etc/kubernetes/cloud.conf
7+
+ value: /etc/config/cloud.conf
8+
- name: CLUSTER_NAME
9+
value: kgcluster131
10+
@@ -177,5 +177,5 @@ spec:
11+
name: cacert
12+
readOnly: true
13+
- - mountPath: /etc/kubernetes
14+
+ - mountPath: /etc/config
15+
name: cloud-config
16+
readOnly: true
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--- cinder-csi-nodeplugin.old.yaml 2025-05-21 15:17:10.849200731 +0000
2+
+++ cinder-csi-nodeplugin.yaml 2025-05-21 15:17:37.264876651 +0000
3+
@@ -85,5 +85,5 @@ spec:
4+
value: unix://csi/csi.sock
5+
- name: CLOUD_CONFIG
6+
- value: /etc/kubernetes/cloud.conf
7+
+ value: /etc/config/cloud.conf
8+
image: registry.k8s.io/provider-os/cinder-csi-plugin:v1.31.3
9+
imagePullPolicy: IfNotPresent
10+
@@ -124,5 +124,5 @@ spec:
11+
name: cacert
12+
readOnly: true
13+
- - mountPath: /etc/kubernetes
14+
+ - mountPath: /etc/config
15+
name: cloud-config
16+
readOnly: true

0 commit comments

Comments
 (0)