Files
docker-registry.helm/templates/serviceaccount.yaml
Devin Canterberry a1cd36f55e 🐞 Add missing namespace to ServiceAccount
When `serviceAccount.create` is `true`, this chart creates
a service account. Currently, that service account will be
created without an explicit namespace. This can be problematic
because the Deployment resource does have an explicit namespace
set. Because the ServiceAccount and Deployment (ultimately, the
Pod) must coexist in the same namespace, we need to follow the
same logic when setting the namespace for both.

Fixes https://github.com/twuni/docker-registry.helm/issues/60.
2022-07-27 23:50:13 -07:00

21 lines
629 B
YAML

{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: {{ template "docker-registry.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
namespace: {{ .Values.namespace | default .Release.Namespace }}
{{- if .Values.serviceAccount.name }}
name: {{ .Values.serviceAccount.name }}
{{- else }}
name: {{ include "docker-registry.fullname" . }}
{{- end }}
{{- if .Values.serviceAccount.annotations }}
annotations:
{{ toYaml .Values.serviceAccount.annotations | indent 4 }}
{{- end }}
{{- end -}}