Support for existingClaim
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
{{- define "common.pvc.tpl" -}}
|
{{- define "common.pvc.tpl" -}}
|
||||||
{{- range .Values.volumes }}
|
{{- range .Values.volumes }}
|
||||||
|
{{- if not .existingClaim }}
|
||||||
{{- $robustName := include "common.robustName" $.Release.Name }}
|
{{- $robustName := include "common.robustName" $.Release.Name }}
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
@@ -15,4 +16,5 @@ spec:
|
|||||||
requests:
|
requests:
|
||||||
storage: {{ .size | default "1Gi" }}
|
storage: {{ .size | default "1Gi" }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|||||||
@@ -4,7 +4,11 @@ volumes:
|
|||||||
{{- range .Values.volumes }}
|
{{- range .Values.volumes }}
|
||||||
- name: {{ .name }}
|
- name: {{ .name }}
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
|
{{- if .existingClaim }}
|
||||||
|
claimName: {{ .existingClaim }}
|
||||||
|
{{ else }}
|
||||||
claimName: {{ printf "%s-%s" $.Release.Name .name }}
|
claimName: {{ printf "%s-%s" $.Release.Name .name }}
|
||||||
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- range .Values.sealedFileSecrets }}
|
{{- range .Values.sealedFileSecrets }}
|
||||||
- name: {{ .name }}
|
- name: {{ .name }}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -60,4 +60,17 @@ tests:
|
|||||||
asserts:
|
asserts:
|
||||||
- equal:
|
- equal:
|
||||||
path: spec.strategy.type
|
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:
|
- equal:
|
||||||
path: spec.storageClassName
|
path: spec.storageClassName
|
||||||
value: default
|
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:
|
volumes:
|
||||||
- name: data
|
- name: data
|
||||||
path: /data
|
path: /data
|
||||||
size: 10Gi
|
existingClaim: myclaim
|
||||||
storageClass: default
|
|
||||||
|
|||||||
Reference in New Issue
Block a user