Add `extraContainers`, `extraEnvVars`, `extraVolumes` & `extraVolumeMounts`

This commit is contained in:
Marcos Lorenzo 2022-10-07 13:36:59 +02:00
parent a64e0dc323
commit 91f762dde9
No known key found for this signature in database
GPG Key ID: DFF4210756D2EF4B
3 changed files with 37 additions and 0 deletions

View File

@ -90,3 +90,16 @@ Selector labels
app: {{ template "nfs-subdir-external-provisioner.name" . }}
release: {{ .Release.Name }}
{{- end }}
{{/*
Renders a value that contains template.
Usage:
{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }}
*/}}
{{- define "common.tplvalues.render" -}}
{{- if typeIs "string" .value }}
{{- tpl .value .context }}
{{- else }}
{{- tpl (.value | toYaml) .context }}
{{- end }}
{{- end -}}

View File

@ -50,6 +50,9 @@ spec:
volumeMounts:
- name: {{ .Values.nfs.volumeName }}
mountPath: /persistentvolumes
{{- if .Values.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
env:
- name: PROVISIONER_NAME
value: {{ template "nfs-subdir-external-provisioner.provisionerName" . }}
@ -61,10 +64,16 @@ spec:
- name: ENABLE_LEADER_ELECTION
value: "false"
{{- end }}
{{- if .Values.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
{{- with .Values.resources }}
resources:
{{ toYaml . | indent 12 }}
{{- end }}
{{- if .Values.extraContainers }}
{{- include "common.tplvalues.render" (dict "value" .Values.extraContainers "context" $) | nindent 8 }}
{{- end }}
volumes:
- name: {{ .Values.nfs.volumeName }}
{{- if .Values.buildMode }}
@ -77,6 +86,9 @@ spec:
server: {{ .Values.nfs.server }}
path: {{ .Values.nfs.path }}
{{- end }}
{{- if .Values.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.extraVolumes "context" $) | nindent 8 }}
{{- end }}
{{- if and (.Values.tolerations) (semverCompare "^1.6-0" .Capabilities.KubeVersion.GitVersion) }}
tolerations:
{{ toYaml .Values.tolerations | indent 6 }}

View File

@ -66,6 +66,18 @@ rbac:
# Specifies whether RBAC resources should be created
create: true
# Additional sidecars
extraContainers: {}
# Additional env vars
extraEnvVars: {}
# Additional volumes
extraVolumes: {}
# Additional volume mounts
extraVolumeMounts: {}
# If true, create & use Pod Security Policy resources
# https://kubernetes.io/docs/concepts/policy/pod-security-policy/
podSecurityPolicy: