Skip to content

Commit e899f9a

Browse files
fix: add annotations input for sa
1 parent bd41bb2 commit e899f9a

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

hosting/k8s/helm/templates/_helpers.tpl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,17 @@ Generate docker config for image pull secret
559559
{{- end }}
560560
{{- end }}
561561

562+
{{/*
563+
Create the name of the webapp service account to use
564+
*/}}
565+
{{- define "trigger-v4.webappServiceAccountName" -}}
566+
{{- if .Values.supervisor.serviceAccount.create }}
567+
{{- default (printf "%s-webapp" (include "trigger-v4.fullname" .)) .Values.webapp.serviceAccount.name }}
568+
{{- else }}
569+
{{- default "default" .Values.webapp.serviceAccount.name }}
570+
{{- end }}
571+
{{- end }}
572+
562573
{{/*
563574
Merge webapp ingress annotations to avoid duplicates
564575
*/}}

hosting/k8s/helm/templates/webapp.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1+
{{- if .Values.webapp.serviceAccount.create }}
12
apiVersion: v1
23
kind: ServiceAccount
34
metadata:
4-
name: {{ include "trigger-v4.fullname" . }}-webapp
5+
name: {{ include "trigger-v4.webappServiceAccountName" . }}
56
labels:
67
{{- $component := "webapp" }}
78
{{- include "trigger-v4.componentLabels" (dict "Chart" .Chart "Release" .Release "Values" .Values "component" $component) | nindent 4 }}
9+
{{- with .Values.webapp.serviceAccount.annotations }}
10+
annotations:
11+
{{- toYaml . | nindent 4 }}
12+
{{- end }}
13+
{{- end }}
814
---
915
apiVersion: rbac.authorization.k8s.io/v1
1016
kind: Role
@@ -27,7 +33,7 @@ metadata:
2733
{{- include "trigger-v4.componentLabels" (dict "Chart" .Chart "Release" .Release "Values" .Values "component" $component) | nindent 4 }}
2834
subjects:
2935
- kind: ServiceAccount
30-
name: {{ include "trigger-v4.fullname" . }}-webapp
36+
name: {{ include "trigger-v4.webappServiceAccountName" . }}
3137
namespace: {{ .Release.Namespace }}
3238
roleRef:
3339
kind: Role
@@ -56,7 +62,7 @@ spec:
5662
labels:
5763
{{- include "trigger-v4.componentSelectorLabels" (dict "Chart" .Chart "Release" .Release "Values" .Values "component" $component) | nindent 8 }}
5864
spec:
59-
serviceAccountName: {{ include "trigger-v4.fullname" . }}-webapp
65+
serviceAccountName: {{ include "trigger-v4.webappServiceAccountName" . }}
6066
{{- with .Values.global.imagePullSecrets }}
6167
imagePullSecrets:
6268
{{- toYaml . | nindent 8 }}

0 commit comments

Comments
 (0)