Skip to content
Snippets Groups Projects
Commit 01f2689e authored by Andri Joos's avatar Andri Joos :blush:
Browse files

add support for multiple volumes

parent 130ba329
No related branches found
No related tags found
No related merge requests found
Pipeline #7234 passed with stage
in 23 seconds
...@@ -15,10 +15,10 @@ type: application ...@@ -15,10 +15,10 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes # 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. # to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/) # 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 # 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 # 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. # follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes. # It is recommended to use it with quotes.
appVersion: "1.0.0" appVersion: "1.1.0"
...@@ -60,14 +60,3 @@ Create the name of the service account to use ...@@ -60,14 +60,3 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }} {{- default "default" .Values.serviceAccount.name }}
{{- end }} {{- end }}
{{- 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 }}
{{- range .Values.volumes }}
---
apiVersion: v1 apiVersion: v1
kind: PersistentVolume kind: PersistentVolume
metadata: metadata:
name: {{ include "nfs-static-provisioning.persistentvolume.name" . }} name: {{ .pvName }}
{{- with .Values.annotations }} {{- with $.Values.annotations }}
annotations: annotations:
{{- toYaml . | nindent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
labels: labels:
{{- include "nfs-static-provisioning.labels" . | nindent 4 }} {{- include "nfs-static-provisioning.labels" $ | nindent 4 }}
spec: spec:
capacity: capacity:
storage: {{ .Values.size }} storage: {{ .size }}
{{- with .Values.accessModes }} {{- with .accessModes }}
accessModes: accessModes:
{{- toYaml . | nindent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
persistentVolumeReclaimPolicy: {{ .Values.reclaimPolicy }} persistentVolumeReclaimPolicy: {{ .reclaimPolicy }}
storageClassName: {{ .Values.storageClassName }} storageClassName: {{ .storageClassName }}
csi: csi:
driver: nfs.csi.k8s.io 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: volumeAttributes:
server: {{ .Values.server }} server: {{ .server }}
share: {{ .Values.path }} share: {{ .path }}
{{- end }}
{{- range .Values.volumes }}
---
apiVersion: v1 apiVersion: v1
kind: PersistentVolumeClaim kind: PersistentVolumeClaim
metadata: metadata:
name: {{ .Release.Name }} name: {{ .name }}
{{- with .Values.annotations }} {{- with $.Values.annotations }}
annotations: annotations:
{{- toYaml . | nindent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
labels: labels:
{{- include "nfs-static-provisioning.labels" . | nindent 4 }} {{- include "nfs-static-provisioning.labels" $ | nindent 4 }}
spec: spec:
{{- with .Values.accessModes }} {{- with .accessModes }}
accessModes: accessModes:
{{- toYaml . | nindent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
storageClassName: {{ .Values.storageClassName }} storageClassName: {{ .storageClassName }}
volumeName: {{ include "nfs-static-provisioning.persistentvolume.name" . }} volumeName: {{ .pvName }}
resources: resources:
requests: requests:
storage: {{ .Values.size }} storage: {{ .size }}
{{- end}}
accessModes: volumes: []
- ReadWriteMany # - name: pvc
# pvName: pv
storageClassName: nfs-csi # size: 1Mi
# reclaimPolicy: Retain
size: 1Mi # storageClassName: nfs-csi
# server: nfs-server.nfs-server.svc.cluster.local
# path: /
# accessModes:
# - ReadWriteMany
annotations: {} 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:
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment