Skip to content

Commit e719920

Browse files
committed
fix(helm): support webapp serviceAccount annotations for IRSA
1 parent 8eb596f commit e719920

3 files changed

Lines changed: 27 additions & 3 deletions

File tree

hosting/k8s/helm/templates/_helpers.tpl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,17 @@ Create the name of the supervisor service account to use
531531
{{- end }}
532532
{{- end }}
533533

534+
{{/*
535+
Create the name of the webapp service account to use
536+
*/}}
537+
{{- define "trigger-v4.webappServiceAccountName" -}}
538+
{{- if .Values.webapp.serviceAccount.create }}
539+
{{- default (printf "%s-webapp" (include "trigger-v4.fullname" .)) .Values.webapp.serviceAccount.name }}
540+
{{- else }}
541+
{{- default "default" .Values.webapp.serviceAccount.name }}
542+
{{- end }}
543+
{{- end }}
544+
534545
{{/*
535546
Create the name of the supervisor role to use
536547
*/}}

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 }}

hosting/k8s/helm/values.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,13 @@ webapp:
208208
runReplication:
209209
logLevel: "info" # one of: log, error, warn, info, debug
210210

211+
# ServiceAccount configuration
212+
serviceAccount:
213+
create: true
214+
name: ""
215+
# Annotations to add to the ServiceAccount (e.g. eks.amazonaws.com/role-arn for IRSA)
216+
annotations: {}
217+
211218
# Observability configuration (OTel)
212219
observability:
213220
tracing:

0 commit comments

Comments
 (0)