Moved volume support to common
This commit is contained in:
@@ -0,0 +1,18 @@
|
|||||||
|
{{- define "common.pvc.tpl" -}}
|
||||||
|
{{- range .Values.volumes }}
|
||||||
|
{{- $robustName := include "common.robustName" $.Release.Name }}
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: {{ printf "%s-%s" $robustName .name }}
|
||||||
|
namespace: {{ $.Release.Namespace }}
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- {{ .accessMode | default "ReadWriteOnce" }}
|
||||||
|
storageClassName: {{ .storageClass | default "local-path" }}
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: {{ .size | default "1Gi" }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
{{- define "common.volumeMountsRef.tpl" -}}
|
||||||
|
{{- if or (or (.Values.volumes) (.Values.sealedFileSecrets)) .Values.fileSecrets }}
|
||||||
|
volumeMounts: &volumeMounts
|
||||||
|
{{- range .Values.volumes }}
|
||||||
|
- name: {{ .name }}
|
||||||
|
mountPath: {{ .path }}
|
||||||
|
{{- end }}
|
||||||
|
{{- range .Values.sealedFileSecrets }}
|
||||||
|
- name: {{ .name }}
|
||||||
|
mountPath: {{ .path }}
|
||||||
|
readOnly: true
|
||||||
|
{{- end }}
|
||||||
|
{{- range .Values.fileSecrets }}
|
||||||
|
- name: {{ .name }}
|
||||||
|
mountPath: {{ .path }}
|
||||||
|
readOnly: true
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
{{- define "common.volumesRef.tpl" -}}
|
||||||
|
{{- if or (or (.Values.volumes) (.Values.sealedFileSecrets)) .Values.fileSecrets }}
|
||||||
|
volumes:
|
||||||
|
{{- range .Values.volumes }}
|
||||||
|
- name: {{ .name }}
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: {{ printf "%s-%s" $.Release.Name .name }}
|
||||||
|
{{- end }}
|
||||||
|
{{- range .Values.sealedFileSecrets }}
|
||||||
|
- name: {{ .name }}
|
||||||
|
secret:
|
||||||
|
secretName: {{ printf "%s-%s" $.Release.Name .name }}
|
||||||
|
{{- end }}
|
||||||
|
{{- range .Values.fileSecrets }}
|
||||||
|
- name: {{ .name }}
|
||||||
|
secret:
|
||||||
|
secretName: {{ printf "%s-%s" $.Release.Name .name }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
Binary file not shown.
@@ -38,19 +38,10 @@ spec:
|
|||||||
- secretRef:
|
- secretRef:
|
||||||
name: {{ .Release.Name }}
|
name: {{ .Release.Name }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
volumeMounts:
|
{{- include "common.volumeMountsRef.tpl" . | nindent 14 }}
|
||||||
{{- range .Values.volumes }}
|
|
||||||
- name: {{ .name }}
|
|
||||||
mountPath: {{ .path }}
|
|
||||||
{{- end }}
|
|
||||||
resources:
|
resources:
|
||||||
{{- toYaml .Values.resources | nindent 16 }}
|
{{- toYaml .Values.resources | nindent 16 }}
|
||||||
volumes:
|
{{- include "common.volumesRef.tpl" . | nindent 10 }}
|
||||||
{{- range .Values.volumes }}
|
|
||||||
- name: {{ .name }}
|
|
||||||
persistentVolumeClaim:
|
|
||||||
claimName: {{ printf "%s-%s" $.Release.Name .name }}
|
|
||||||
{{- end }}
|
|
||||||
{{ with .Values.nodeSelector }}
|
{{ with .Values.nodeSelector }}
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
{{ toYaml . | nindent 8 }}
|
{{ toYaml . | nindent 8 }}
|
||||||
|
|||||||
@@ -1,15 +1 @@
|
|||||||
{{- range .Values.volumes }}
|
{{- include "common.pvc.tpl" . -}}
|
||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
kind: PersistentVolumeClaim
|
|
||||||
metadata:
|
|
||||||
name: {{ printf "%s-%s" $.Release.Name .name }}
|
|
||||||
namespace: {{ $.Release.Namespace }}
|
|
||||||
spec:
|
|
||||||
accessModes:
|
|
||||||
- {{ .accessMode | default "ReadWriteOnce" }}
|
|
||||||
storageClassName: {{ .storageClass | default "local-path" }}
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
storage: {{ .size | default "1Gi" }}
|
|
||||||
{{- end }}
|
|
||||||
|
|||||||
Binary file not shown.
@@ -102,23 +102,7 @@ spec:
|
|||||||
{{- toYaml . | nindent 12 }}
|
{{- toYaml . | nindent 12 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if or (or (.Values.volumes) (.Values.sealedFileSecrets)) .Values.fileSecrets }}
|
{{- include "common.volumeMountsRef.tpl" . | nindent 10 }}
|
||||||
volumeMounts: &volumeMounts
|
|
||||||
{{- range .Values.volumes }}
|
|
||||||
- name: {{ .name }}
|
|
||||||
mountPath: {{ .path }}
|
|
||||||
{{- end }}
|
|
||||||
{{- range .Values.sealedFileSecrets }}
|
|
||||||
- name: {{ .name }}
|
|
||||||
mountPath: {{ .path }}
|
|
||||||
readOnly: true
|
|
||||||
{{- end }}
|
|
||||||
{{- range .Values.fileSecrets }}
|
|
||||||
- name: {{ .name }}
|
|
||||||
mountPath: {{ .path }}
|
|
||||||
readOnly: true
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
resources:
|
resources:
|
||||||
{{- toYaml .Values.resources | nindent 12 }}
|
{{- toYaml .Values.resources | nindent 12 }}
|
||||||
{{- if .Values.sidecar }}
|
{{- if .Values.sidecar }}
|
||||||
@@ -138,24 +122,7 @@ spec:
|
|||||||
volumeMounts: *volumeMounts
|
volumeMounts: *volumeMounts
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if or (or (.Values.volumes) (.Values.sealedFileSecrets)) .Values.fileSecrets }}
|
{{- include "common.volumesRef.tpl" . | nindent 6 }}
|
||||||
volumes:
|
|
||||||
{{- range .Values.volumes }}
|
|
||||||
- name: {{ .name }}
|
|
||||||
persistentVolumeClaim:
|
|
||||||
claimName: {{ printf "%s-%s" $.Release.Name .name }}
|
|
||||||
{{- end }}
|
|
||||||
{{- range .Values.sealedFileSecrets }}
|
|
||||||
- name: {{ .name }}
|
|
||||||
secret:
|
|
||||||
secretName: {{ printf "%s-%s" $.Release.Name .name }}
|
|
||||||
{{- end }}
|
|
||||||
{{- range .Values.fileSecrets }}
|
|
||||||
- name: {{ .name }}
|
|
||||||
secret:
|
|
||||||
secretName: {{ printf "%s-%s" $.Release.Name .name }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
{{- with .Values.nodeSelector }}
|
{{- with .Values.nodeSelector }}
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
{{- toYaml . | nindent 8 }}
|
{{- toYaml . | nindent 8 }}
|
||||||
|
|||||||
@@ -1,16 +1 @@
|
|||||||
{{- range .Values.volumes }}
|
{{- include "common.pvc.tpl" . -}}
|
||||||
{{- $robustName := include "robustName" $.Release.Name }}
|
|
||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
kind: PersistentVolumeClaim
|
|
||||||
metadata:
|
|
||||||
name: {{ printf "%s-%s" $robustName .name }}
|
|
||||||
namespace: {{ $.Release.Namespace }}
|
|
||||||
spec:
|
|
||||||
accessModes:
|
|
||||||
- {{ .accessMode | default "ReadWriteOnce" }}
|
|
||||||
storageClassName: {{ .storageClass | default "local-path" }}
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
storage: {{ .size | default "1Gi" }}
|
|
||||||
{{- end }}
|
|
||||||
|
|||||||
@@ -9,3 +9,9 @@ shell: "/bin/sh"
|
|||||||
|
|
||||||
vars:
|
vars:
|
||||||
MY_VAR: "value"
|
MY_VAR: "value"
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: data
|
||||||
|
path: /data
|
||||||
|
size: 10Gi
|
||||||
|
storageClass: default
|
||||||
|
|||||||
@@ -15,3 +15,9 @@ gitSha: xyz
|
|||||||
|
|
||||||
vars:
|
vars:
|
||||||
MY_VAR: "value"
|
MY_VAR: "value"
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: data
|
||||||
|
path: /data
|
||||||
|
size: 10Gi
|
||||||
|
storageClass: default
|
||||||
|
|||||||
Reference in New Issue
Block a user