Start using csi_cinder_volume_binding_mode config

By default, since release 0.8.0 of capi-helm, it has
been defaulting to WaitForFirstConsumer for additional
storage classes.
8541729666

Note, if you are upgrading from an older version,
we hit some upgrade issues due to immutable storage
classes being unable to be updated.

As a work around, we are actully making use of the
existing config, to keep the behaviour the same as
the current release of the capi-helm-charts.
But those using older versions, before 0.8.0, may
need to change the configuration to match their existing
choices, ahead of their upgrade.

Change-Id: If90e0143f56ee378f5401b01623c159836fef29c
Signed-off-by: John Garbutt <john.garbutt@stackhpc.com>
This commit is contained in:
John Garbutt
2025-12-08 10:01:16 +00:00
parent 8c1012c211
commit d60ae3f89c
3 changed files with 22 additions and 1 deletions

View File

@@ -111,7 +111,8 @@ capi_helm_opts = [
),
cfg.StrOpt(
"csi_cinder_volume_binding_mode",
default="Immediate",
default="WaitForFirstConsumer",
choices=["WaitForFirstConsumer", "Immediate"],
help=(
"The volumeBindingMode field controls when "
"volume binding and dynamic provisioning should occur."

View File

@@ -771,6 +771,13 @@ class Driver(driver.Driver):
CONF.capi_helm.csi_cinder_reclaim_policy,
)
def _get_csi_cinder_volume_binding_mode(self, cluster):
return self._label(
cluster,
"csi_cinder_volume_binding_mode",
CONF.capi_helm.csi_cinder_volume_binding_mode,
)
def _get_csi_cinder_fstype(self, cluster):
return self._label(
cluster,
@@ -836,6 +843,7 @@ class Driver(driver.Driver):
additional_storage_classes = []
allow_expansion = self._get_csi_cinder_allow_volume_expansion(cluster)
reclaim_policy = self._get_csi_cinder_reclaim_policy(cluster)
binding_mode = self._get_csi_cinder_volume_binding_mode(cluster)
allowed_topologies = CONF.capi_helm.csi_cinder_allowed_topologies
fstype = self._get_csi_cinder_fstype(cluster)
@@ -844,6 +852,7 @@ class Driver(driver.Driver):
"name": driver_utils.sanitized_name(volume_type),
"reclaimPolicy": reclaim_policy,
"allowVolumeExpansion": allow_expansion,
"volumeBindingMode": binding_mode,
"availabilityZone": availability_zone,
"volumeType": volume_type,
"allowedTopologies": allowed_topologies,

View File

@@ -0,0 +1,11 @@
---
upgrade:
- |
csi_cinder_volume_binding_mode previously had no effect. If you use
capi-helm-charts<0.8.0 then you would have set it to Immediate and since
0.8.0 it has defaulted to WaitForFirstConsumer. The configuration is now
being used, and we have set the default to match the new versions of the
capi-helm-charts. However, if you have older clusters using a template
with a very old capi-helm-chart, then really you need to keep the older
default, to avoid a breakage on upgrade. This is specifically because
the storage class, once created, is immutable.