diff --git a/templates/_statefulset.tpl b/templates/_statefulset.tpl index c9355e9..6992bcb 100644 --- a/templates/_statefulset.tpl +++ b/templates/_statefulset.tpl @@ -58,14 +58,11 @@ spec: {{- toYaml .Values.readinessProbe | nindent 12 }} resources: {{- toYaml .Values.resources | nindent 12 }} - {{- with .Values.volumeMounts }} volumeMounts: - {{- toYaml . | nindent 12 }} - {{- end }} - {{- with .Values.volumes }} - volumes: - {{- toYaml . | nindent 8 }} - {{- end }} + {{- range $i, $values := .Values.volumeClaimTemplates }} + - name: {{ $values.name }} + mountPath: {{ $values.mountPath }} + {{- end }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} @@ -78,4 +75,16 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} + volumeClaimTemplates: + {{- range $i, $values := .Values.volumeClaimTemplates }} + - metadata: + name: {{ $values.name }} + spec: + accessModes: + - {{ required (printf "accessMode is required for volumeClaimTemplate %v" $values.name) $values.accessMode | quote }} + storageClassName: {{ required (printf "storageClassName is required for volumeClaimTemplate %v" $values.name) $values.storageClassName | quote }} + resources: + requests: + storage: {{ required (printf "size is required for volumeClaimTemplate %v" $values.name) $values.size | quote }} + {{- end }} {{- end -}} diff --git a/values.yaml b/values.yaml index 99bd303..a8258ed 100644 --- a/values.yaml +++ b/values.yaml @@ -120,6 +120,17 @@ volumeMounts: [] # mountPath: "/etc/foo" # readOnly: true +# used for statefulset https://kubernetes.io/docs/concepts/workloads/controllers/statefulset +volumeClaimTemplates: [] +#volumeClaimTemplates: +# - name: www +# mountPath: /var/www/html +# accessModes: "ReadWriteOnce" +# storageClassName: "my-storage-class" +# size: 1Gi + + + serviceAccount: # Specifies whether a service account should be created create: true