Support for existingClaim
This commit is contained in:
@@ -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,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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user