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,8 +4,12 @@ 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 }}
|
||||
secret:
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -61,3 +61,16 @@ tests:
|
||||
- equal:
|
||||
path: spec.strategy.type
|
||||
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
|
||||
|
||||
+1
-2
@@ -21,5 +21,4 @@ vars:
|
||||
volumes:
|
||||
- name: data
|
||||
path: /data
|
||||
size: 10Gi
|
||||
storageClass: default
|
||||
existingClaim: myclaim
|
||||
|
||||
Reference in New Issue
Block a user