From 751ebe8650f31d9959109064e0bac21db1b18cef Mon Sep 17 00:00:00 2001 From: Simon KP Date: Mon, 5 Jan 2026 14:37:46 +0800 Subject: [PATCH] Fix serviceAccountName not being set when create=false Two bugs were causing deployments to use the default service account when serviceAccount.create=false: 1. _helpers.tpl used .Values.service.name instead of .Values.serviceAccount.name 2. deployment.yaml only set serviceAccountName when create=true Now serviceAccountName is set whenever serviceAccount.name is provided, regardless of whether the chart creates the service account or uses an existing one. --- charts/common/Chart.yaml | 2 +- charts/common/templates/_helpers.tpl | 2 +- charts/common/templates/deployment.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/charts/common/Chart.yaml b/charts/common/Chart.yaml index a2c28dd..1ff972a 100644 --- a/charts/common/Chart.yaml +++ b/charts/common/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.2.0 +version: 0.2.1 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/common/templates/_helpers.tpl b/charts/common/templates/_helpers.tpl index 982b3c2..dc4d6bf 100644 --- a/charts/common/templates/_helpers.tpl +++ b/charts/common/templates/_helpers.tpl @@ -55,5 +55,5 @@ app.kubernetes.io/serviceName: {{ include "common.fullname" .}} Create the name of the service account to use */}} {{- define "common.serviceAccountName" -}} -{{- default "default" .Values.service.name }} +{{- default "default" .Values.serviceAccount.name }} {{- end }} diff --git a/charts/common/templates/deployment.yaml b/charts/common/templates/deployment.yaml index 082ed17..6503022 100644 --- a/charts/common/templates/deployment.yaml +++ b/charts/common/templates/deployment.yaml @@ -77,7 +77,7 @@ spec: imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} - {{- if .Values.serviceAccount.create }} + {{- if .Values.serviceAccount.name }} serviceAccountName: {{ include "common.serviceAccountName" . }} {{- end }} securityContext: