{{- if .Values.terminatingGateways.enabled }} {{- $root := . }} {{- $defaults := .Values.terminatingGateways.defaults }} {{- range .Values.terminatingGateways.gateways }} {{- $serviceAccount := .serviceAccount }} apiVersion: v1 kind: ServiceAccount metadata: name: {{ template "consul.fullname" $root }}-{{ .name }} namespace: {{ $root.Release.Namespace }} labels: app: {{ template "consul.name" $root }} chart: {{ template "consul.chart" $root }} heritage: {{ $root.Release.Service }} release: {{ $root.Release.Name }} component: terminating-gateway terminating-gateway-name: {{ template "consul.fullname" $root }}-{{ .name }} {{- if (or $defaults.serviceAccount.annotations $serviceAccount.annotations) }} annotations: {{- if $defaults.serviceAccount.annotations }} {{ tpl $defaults.serviceAccount.annotations $root | nindent 4 | trim }} {{- end }} {{- if $serviceAccount.annotations }} {{ tpl $serviceAccount.annotations $root | nindent 4 | trim }} {{- end }} {{- end }} {{- with $root.Values.global.imagePullSecrets }} imagePullSecrets: {{- range . }} - name: {{ .name }} {{- end }} {{- end }} --- {{- end }} {{- end }}