Support for existingClaim

This commit is contained in:
Laszlo Fogas
2021-09-15 08:48:38 +02:00
parent 07afdb14c1
commit 937cb67c30
7 changed files with 30 additions and 3 deletions
+2
View File
@@ -1,5 +1,6 @@
{{- define "common.pvc.tpl" -}}
{{- range .Values.volumes }}
{{- if not .existingClaim }}
{{- $robustName := include "common.robustName" $.Release.Name }}
---
apiVersion: v1
@@ -15,4 +16,5 @@ spec:
requests:
storage: {{ .size | default "1Gi" }}
{{- end }}
{{- end }}
{{- end -}}
+4
View File
@@ -4,7 +4,11 @@ volumes:
{{- range .Values.volumes }}
- name: {{ .name }}
persistentVolumeClaim:
{{- if .existingClaim }}
claimName: {{ .existingClaim }}
{{ else }}
claimName: {{ printf "%s-%s" $.Release.Name .name }}
{{- end }}
{{- end }}
{{- range .Values.sealedFileSecrets }}
- name: {{ .name }}
Binary file not shown.
Binary file not shown.
@@ -60,4 +60,17 @@ tests:
asserts:
- equal:
path: spec.strategy.type
value: Dummy
value: Dummy
- it: Should use the existing claim
set:
volumes:
- name: data
path: /var/lib/1clickinfra/data
existingClaim: my-static-claim
asserts:
- equal:
path: spec.template.spec.volumes
value:
- name: data
persistentVolumeClaim:
claimName: my-static-claim
+9
View File
@@ -13,3 +13,12 @@ tests:
- equal:
path: spec.storageClassName
value: default
- it: Should not generate a claim when using existing claim
set:
volumes:
- name: data
path: /var/lib/1clickinfra/data
existingClaim: my-static-claim
asserts:
- hasDocuments:
count: 0