vsphere-tmm / helm-charts

A repository of unofficial helm charts for vSphere components
https://vsphere-tmm.github.io/helm-charts/
21 stars 27 forks source link

Allow custom name for the storageclass #73

Closed cdtzabra closed 7 months ago

cdtzabra commented 9 months ago

https://github.com/vsphere-tmm/helm-charts/blob/2ab18409e5769378d09771d0583a9b89f9547258/charts/vsphere-csi/templates/storageclass.yaml#L6

Right now, the storageclass name is fixed as vsphere-csi
Do you mind to allow user to have a possibility to specify a custom name through anew variable .Values.global.config.storageclass.name

Due to this previous issue https://github.com/vsphere-tmm/helm-charts/issues/67 , I created the storageclass separately with helm_release provider and the name of my storageclass is thin-csi

And since the issue is closed, I wanted to use it and delete my resource storageclassdeployed separately. but i realized that the name is hard-coded vsphere-csi in helm and won't match with my name thin-csi which is already used in prod

I tried to push a PR but permission denied

Sur la branche cdtzabra
Modifications qui ne seront pas validées :
  (utilisez "git add <fichier>..." pour mettre à jour ce qui sera validé)
  (utilisez "git restore <fichier>..." pour annuler les modifications dans le répertoire de travail)
    modifié :         Chart.yaml
    modifié :         templates/storageclass.yaml
    modifié :         values.yaml

aucune modification n'a été ajoutée à la validation (utilisez "git add" ou "git commit -a")
zabra@zabra-Mission-Mi:~/workspace/contrib/helm-charts/charts/vsphere-csi$ git diff
diff --git a/charts/vsphere-csi/Chart.yaml b/charts/vsphere-csi/Chart.yaml
index f5900cd..184b3f9 100644
--- a/charts/vsphere-csi/Chart.yaml
+++ b/charts/vsphere-csi/Chart.yaml
@@ -35,4 +35,4 @@ maintainers:
 name: vsphere-csi
 sources:
   - https://github.com/kubernetes-sigs/vsphere-csi-driver
-version: 3.3.1
+version: 3.3.2
diff --git a/charts/vsphere-csi/templates/storageclass.yaml b/charts/vsphere-csi/templates/storageclass.yaml
index 2a61193..a70e622 100644
--- a/charts/vsphere-csi/templates/storageclass.yaml
+++ b/charts/vsphere-csi/templates/storageclass.yaml
@@ -3,7 +3,7 @@
 kind: StorageClass
 apiVersion: storage.k8s.io/v1
 metadata:
-  name: vsphere-csi
+  name: {{.Values.global.config.storageclass.name }}
 {{- if .Values.global.config.storageclass.default }}
   annotations:
     storageclass.kubernetes.io/is-default-class: "true"
diff --git a/charts/vsphere-csi/values.yaml b/charts/vsphere-csi/values.yaml
index bea9f78..00417fc 100644
--- a/charts/vsphere-csi/values.yaml
+++ b/charts/vsphere-csi/values.yaml
@@ -28,6 +28,7 @@ global:
     csidriver:
       enabled: true
 ## @param global.config.storageclass.enabled Enable creation of StorageClass
+## @param global.config.storageclass.name Set name for storageclass
 ## @param global.config.storageclass.storagepolicyname Set storagePolicyName
 ## @param global.config.storageclass.expansion Enable VolumeExpansion for storageclass, see https://vsphere-csi-driver.sigs.k8s.io/features/volume_expansion.html
 ## @param global.config.storageclass.default Make created storageClass default
@@ -35,6 +36,7 @@ global:

     storageclass:
       enabled: false
+      name: "vsphere-csi"
       storagepolicyname: ""
       expansion: false # https://vsphere-csi-driver.sigs.k8s.io/features/volume_expansion.html
       default: false
MaxRink commented 7 months ago

can now be set by .Values.global.config.storageclass.name

cdtzabra commented 7 months ago

Thanks !