diff --git a/nfs-static-provisioning/Chart.yaml b/nfs-static-provisioning/Chart.yaml index fc2b76be28f9c8829abc7d85c1b1254157801ac5..b80576b8f487021794dc552273b4b7417c7bc86d 100644 --- a/nfs-static-provisioning/Chart.yaml +++ b/nfs-static-provisioning/Chart.yaml @@ -15,10 +15,10 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 1.0.0 +version: 1.1.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. -appVersion: "1.0.0" +appVersion: "1.1.0" diff --git a/nfs-static-provisioning/templates/_helpers.tpl b/nfs-static-provisioning/templates/_helpers.tpl index 303fc0fe9ac0f5d414c1038e2c725f30e74f649b..19e331efe8a8c801218e032a37830f9f5afd95af 100644 --- a/nfs-static-provisioning/templates/_helpers.tpl +++ b/nfs-static-provisioning/templates/_helpers.tpl @@ -60,14 +60,3 @@ Create the name of the service account to use {{- default "default" .Values.serviceAccount.name }} {{- end }} {{- end }} - -{{/* -PersistentVolume -*/}} -{{- define "nfs-static-provisioning.persistentvolume.name" -}} -{{- if .Values.pvName }} -{{- printf "pvc-static-%s" .Values.pvName }} -{{- else}} -{{- printf "pvc-static-%s" uuidv4 }} -{{- end }} -{{- end }} diff --git a/nfs-static-provisioning/templates/persistentVolume.yaml b/nfs-static-provisioning/templates/persistentVolume.yaml index fa75cf826f9ab807332fa1783a4899f41b51bc35..abe9c16f6eaab6e3d0260b6d2cee6ac561004200 100644 --- a/nfs-static-provisioning/templates/persistentVolume.yaml +++ b/nfs-static-provisioning/templates/persistentVolume.yaml @@ -1,25 +1,28 @@ +{{- range .Values.volumes }} +--- apiVersion: v1 kind: PersistentVolume metadata: - name: {{ include "nfs-static-provisioning.persistentvolume.name" . }} - {{- with .Values.annotations }} + name: {{ .pvName }} + {{- with $.Values.annotations }} annotations: {{- toYaml . | nindent 4 }} {{- end }} labels: - {{- include "nfs-static-provisioning.labels" . | nindent 4 }} + {{- include "nfs-static-provisioning.labels" $ | nindent 4 }} spec: capacity: - storage: {{ .Values.size }} - {{- with .Values.accessModes }} + storage: {{ .size }} + {{- with .accessModes }} accessModes: {{- toYaml . | nindent 4 }} {{- end }} - persistentVolumeReclaimPolicy: {{ .Values.reclaimPolicy }} - storageClassName: {{ .Values.storageClassName }} + persistentVolumeReclaimPolicy: {{ .reclaimPolicy }} + storageClassName: {{ .storageClassName }} csi: driver: nfs.csi.k8s.io - volumeHandle: {{ include "nfs-static-provisioning.persistentvolume.name" . }} # Unique identifier for the NFS volume + volumeHandle: {{ .pvName }} # Unique identifier for the NFS volume volumeAttributes: - server: {{ .Values.server }} - share: {{ .Values.path }} + server: {{ .server }} + share: {{ .path }} +{{- end }} diff --git a/nfs-static-provisioning/templates/persistentVolumeClaim.yaml b/nfs-static-provisioning/templates/persistentVolumeClaim.yaml index e8252e78c695e09039d93e3251704560d063fc67..d50475c822ad01a81153bd6b71089339e7952aaa 100644 --- a/nfs-static-provisioning/templates/persistentVolumeClaim.yaml +++ b/nfs-static-provisioning/templates/persistentVolumeClaim.yaml @@ -1,20 +1,23 @@ +{{- range .Values.volumes }} +--- apiVersion: v1 kind: PersistentVolumeClaim metadata: - name: {{ .Release.Name }} - {{- with .Values.annotations }} + name: {{ .name }} + {{- with $.Values.annotations }} annotations: {{- toYaml . | nindent 4 }} {{- end }} labels: - {{- include "nfs-static-provisioning.labels" . | nindent 4 }} + {{- include "nfs-static-provisioning.labels" $ | nindent 4 }} spec: - {{- with .Values.accessModes }} + {{- with .accessModes }} accessModes: {{- toYaml . | nindent 4 }} {{- end }} - storageClassName: {{ .Values.storageClassName }} - volumeName: {{ include "nfs-static-provisioning.persistentvolume.name" . }} + storageClassName: {{ .storageClassName }} + volumeName: {{ .pvName }} resources: requests: - storage: {{ .Values.size }} + storage: {{ .size }} +{{- end}} diff --git a/nfs-static-provisioning/values.yaml b/nfs-static-provisioning/values.yaml index 1505acf9a30a2dd434f2bbfbe3983a00ce23787e..4ba3564aff7f80f510fd623261ecfe146daa2924 100644 --- a/nfs-static-provisioning/values.yaml +++ b/nfs-static-provisioning/values.yaml @@ -1,17 +1,12 @@ -accessModes: -- ReadWriteMany - -storageClassName: nfs-csi - -size: 1Mi +volumes: [] +# - name: pvc +# pvName: pv +# size: 1Mi +# reclaimPolicy: Retain +# storageClassName: nfs-csi +# server: nfs-server.nfs-server.svc.cluster.local +# path: / +# accessModes: +# - ReadWriteMany annotations: {} - -reclaimPolicy: Retain - -server: nfs-server.nfs-server.svc.cluster.local -path: / - -# It is highly recommended to set pvName, otherwise it is generated using uuid4. -# Therefore, the pv changes everytime, which leads to errors while applying because the volumeName in the pvc is not allowed to change -pvName: