Skip to content

Commit

Permalink
Merge branch 'main' into KU-1026/lp2067404-controllerplugin-unavailable
Browse files Browse the repository at this point in the history
  • Loading branch information
addyess authored Dec 5, 2024
2 parents be0acad + e0ade0d commit ad0446c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
10 changes: 9 additions & 1 deletion config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,12 @@ options:
through to the parameters.reclaimPolicy field of the csi-cinder-default
StorageClass.
Potential values are "Delete" or "Retain"
Potential values are "Delete" or "Retain"
storage-class-default:
type: boolean
default: false
description: |
https://kubernetes.io/docs/tasks/administer-cluster/change-default-storage-class/
Whether to set the storage class for the Cinder CSI driver as the cluster default
6 changes: 5 additions & 1 deletion src/storage_manifests.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,16 @@ def __call__(self) -> Optional[AnyResource]:
storage_name = STORAGE_CLASS_NAME.format(type=self.type)
log.info(f"Creating storage class {storage_name}")
reclaim_policy: str = self.manifests.config.get("reclaim-policy") or "Delete"
is_default: str = "true" if self.manifests.config.get("storage-class-default") else "false"

sc = from_dict(
dict(
apiVersion="storage.k8s.io/v1",
kind="StorageClass",
metadata=dict(name=storage_name),
metadata=dict(
name=storage_name,
annotations={"storageclass.kubernetes.io/is-default-class": is_default},
),
provisioner="cinder.csi.openstack.org",
reclaimPolicy=reclaim_policy.title(),
volumeBindingMode="WaitForFirstConsumer",
Expand Down

0 comments on commit ad0446c

Please sign in to comment.