Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions hosting/k8s/helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,17 @@ Generate docker config for image pull secret
{{- end }}
{{- end }}

{{/*
Create the name of the webapp service account to use
*/}}
{{- define "trigger-v4.webappServiceAccountName" -}}
{{- if .Values.supervisor.serviceAccount.create }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Copy-paste error: webappServiceAccountName checks supervisor.serviceAccount.create instead of webapp.serviceAccount.create

The new trigger-v4.webappServiceAccountName helper at hosting/k8s/helm/templates/_helpers.tpl:566 checks .Values.supervisor.serviceAccount.create instead of .Values.webapp.serviceAccount.create. This was clearly copied from the supervisor helper at hosting/k8s/helm/templates/_helpers.tpl:526-532 without updating the condition.

With default values, supervisor.serviceAccount.create is true, so this helper always returns the auto-generated name <fullname>-webapp. However, webapp.yaml:1 correctly checks .Values.webapp.serviceAccount.create (which has no default in values.yaml and evaluates to nil/false), so the ServiceAccount resource is not created. This results in the Deployment (line 65) and RoleBinding (line 36) referencing a ServiceAccount that doesn't exist, causing pod scheduling failures.

Suggested change
{{- if .Values.supervisor.serviceAccount.create }}
{{- if .Values.webapp.serviceAccount.create }}
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

{{- default (printf "%s-webapp" (include "trigger-v4.fullname" .)) .Values.webapp.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.webapp.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Merge webapp ingress annotations to avoid duplicates
*/}}
Expand Down
12 changes: 9 additions & 3 deletions hosting/k8s/helm/templates/webapp.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
{{- if .Values.webapp.serviceAccount.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "trigger-v4.fullname" . }}-webapp
name: {{ include "trigger-v4.webappServiceAccountName" . }}
labels:
{{- $component := "webapp" }}
{{- include "trigger-v4.componentLabels" (dict "Chart" .Chart "Release" .Release "Values" .Values "component" $component) | nindent 4 }}
{{- with .Values.webapp.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
Expand All @@ -27,7 +33,7 @@ metadata:
{{- include "trigger-v4.componentLabels" (dict "Chart" .Chart "Release" .Release "Values" .Values "component" $component) | nindent 4 }}
subjects:
- kind: ServiceAccount
name: {{ include "trigger-v4.fullname" . }}-webapp
name: {{ include "trigger-v4.webappServiceAccountName" . }}
namespace: {{ .Release.Namespace }}
roleRef:
kind: Role
Expand Down Expand Up @@ -56,7 +62,7 @@ spec:
labels:
{{- include "trigger-v4.componentSelectorLabels" (dict "Chart" .Chart "Release" .Release "Values" .Values "component" $component) | nindent 8 }}
spec:
serviceAccountName: {{ include "trigger-v4.fullname" . }}-webapp
serviceAccountName: {{ include "trigger-v4.webappServiceAccountName" . }}
{{- with .Values.global.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
Expand Down