Add namespace to the template helpers

Signed-off-by: Konstantin Semenov <ksemenov@pivotal.io>
Co-authored-by: Konstantin Semenov <ksemenov@pivotal.io>
pull/7332/head
Christian Mc Carthy 6 years ago committed by Konstantin Semenov
parent ebd89817bf
commit f1b0fae172

@ -249,13 +249,13 @@ spec:
labels: labels:
{{- include "<CHARTNAME>.selectorLabels" . | nindent 8 }} {{- include "<CHARTNAME>.selectorLabels" . | nindent 8 }}
spec: spec:
{{ include "imagePullSecrets" . | indent 6 }} {{ include "<CHARTNAME>.imagePullSecrets" . | indent 6 }}
serviceAccountName: {{ include "<CHARTNAME>.serviceAccountName" . }} serviceAccountName: {{ include "<CHARTNAME>.serviceAccountName" . }}
securityContext: securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }} {{- toYaml .Values.podSecurityContext | nindent 8 }}
containers: containers:
- name: {{ .Chart.Name }} - name: {{ .Chart.Name }}
{{ include "registryImage" (dict "image" .Values.images.nginx "global" .Values.global) | indent 10 }} {{ include "<CHARTNAME>.registryImage" (dict "image" .Values.images.nginx "global" .Values.global) | indent 10 }}
securityContext: securityContext:
{{- toYaml .Values.securityContext | nindent 12 }} {{- toYaml .Values.securityContext | nindent 12 }}
ports: ports:
@ -404,16 +404,16 @@ Create the name of the service account to use
Create a registry image reference for use in a spec. Create a registry image reference for use in a spec.
Includes the 'image' and 'imagePullPolicy' keys. Includes the 'image' and 'imagePullPolicy' keys.
*/}} */}}
{{- define "registryImage" -}} {{- define "<CHARTNAME>.registryImage" -}}
image: {{ include "imageReference" . }} image: {{ include "<CHARTNAME>.imageReference" . }}
{{ include "imagePullPolicy" . }} {{ include "<CHARTNAME>.imagePullPolicy" . }}
{{- end -}} {{- end -}}
{{/* {{/*
The most complete image reference, including the The most complete image reference, including the
registry address, repository, tag and digest when available. registry address, repository, tag and digest when available.
*/}} */}}
{{- define "imageReference" -}} {{- define "<CHARTNAME>.imageReference" -}}
{{ $registry := coalesce .image.registry .global.imageRegistry "docker.io" }} {{ $registry := coalesce .image.registry .global.imageRegistry "docker.io" }}
{{- printf "%s/%s:%s" $registry .image.name .image.tag -}} {{- printf "%s/%s:%s" $registry .image.name .image.tag -}}
{{- if .image.digest -}} {{- if .image.digest -}}
@ -424,7 +424,7 @@ registry address, repository, tag and digest when available.
{{/* {{/*
Specify the image pull policy Specify the image pull policy
*/}} */}}
{{- define "imagePullPolicy" -}} {{- define "<CHARTNAME>.imagePullPolicy" -}}
{{ $policy := coalesce .image.pullPolicy .global.imagePullPolicy }} {{ $policy := coalesce .image.pullPolicy .global.imagePullPolicy }}
{{- if $policy -}} {{- if $policy -}}
imagePullPolicy: "{{ printf "%s" $policy -}}" imagePullPolicy: "{{ printf "%s" $policy -}}"
@ -434,7 +434,7 @@ imagePullPolicy: "{{ printf "%s" $policy -}}"
{{/* {{/*
Use the image pull secrets. All of the specified secrets will be used Use the image pull secrets. All of the specified secrets will be used
*/}} */}}
{{- define "imagePullSecrets" -}} {{- define "<CHARTNAME>.imagePullSecrets" -}}
{{- $secrets := .Values.global.imagePullSecrets -}} {{- $secrets := .Values.global.imagePullSecrets -}}
{{- range $_, $image := .Values.images -}} {{- range $_, $image := .Values.images -}}
{{- range $_, $s := $image.pullSecrets -}} {{- range $_, $s := $image.pullSecrets -}}

Loading…
Cancel
Save