Skip to content

Commit

Permalink
Add option to override the volume name (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
maboehm authored May 27, 2024
1 parent d6e54f2 commit 7234adc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
7 changes: 7 additions & 0 deletions charts/etcd/templates/_helper.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{- define "dataVolumeName" -}}
{{- if (.Values.volumeClaimNameOverride) -}}
{{ .Values.volumeClaimNameOverride }}
{{- else -}}
virtual-garden-{{ .Values.name }}
{{- end -}}
{{- end -}}
6 changes: 3 additions & 3 deletions charts/etcd/templates/statefulset-etcd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ spec:
cpu: {{ .Values.resources.limits.cpu | default "1000m" }}
memory: {{ .Values.resources.limits.memory | default "2560Mi" }}
volumeMounts:
- name: virtual-garden-{{ .Values.name }}
- name: {{ template "dataVolumeName" . }}
mountPath: /var/etcd/data
- name: etcd-bootstrap
mountPath: /bootstrap
Expand Down Expand Up @@ -171,7 +171,7 @@ spec:
volumeMounts:
- name: etcd-bootstrap
mountPath: /bootstrap
- name: virtual-garden-{{ .Values.name }}
- name: {{ template "dataVolumeName" . }}
mountPath: /var/etcd/data
- name: ca-etcd
mountPath: /var/etcd/ssl/ca
Expand Down Expand Up @@ -208,7 +208,7 @@ spec:
{{- end }}
volumeClaimTemplates:
- metadata:
name: virtual-garden-{{ .Values.name }}
name: {{ template "dataVolumeName" . }}
spec:
accessModes:
- "ReadWriteOnce"
Expand Down
2 changes: 2 additions & 0 deletions charts/etcd/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,5 @@ resources:
volumeClaimTemplates:
requests:
storage: 10Gi

volumeClaimNameOverride: "" # override name of volumeClaim. Defaults to `virtual-garden-{{ .Values.name }}`

0 comments on commit 7234adc

Please sign in to comment.