Skip to content

Comments

Fix serviceAccountName not being set when create=false#64

Merged
eskp merged 1 commit intomainfrom
fix/service-account-name
Jan 5, 2026
Merged

Fix serviceAccountName not being set when create=false#64
eskp merged 1 commit intomainfrom
fix/service-account-name

Conversation

@eskp
Copy link
Member

@eskp eskp commented Jan 5, 2026

Problem

Deployments using serviceAccount.create: false with an existing service account name were incorrectly using the default service account instead of the specified one.

Root Cause

Two bugs in the common chart:

  1. _helpers.tpl - common.serviceAccountName helper used .Values.service.name instead of .Values.serviceAccount.name

  2. deployment.yaml - Only set serviceAccountName when serviceAccount.create was true:

    {{- if .Values.serviceAccount.create }}
    serviceAccountName: {{ include "common.serviceAccountName" . }}
    {{- end }}

Fix

  1. Fixed helper to use correct path: .Values.serviceAccount.name
  2. Changed condition to check serviceAccount.name instead of serviceAccount.create

Now serviceAccountName is set whenever a name is provided, regardless of whether the chart creates the SA or uses an existing one.

Test Plan

  • Deploy with serviceAccount.create: true → SA created and used
  • Deploy with serviceAccount.create: false, name: existing-sa → existing SA used

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.
@eskp eskp requested review from OleksandrUA and nickkounz January 5, 2026 06:39
@github-actions
Copy link

github-actions bot commented Jan 5, 2026

🎉 Helm Chart Tests Passed!

All modified charts have been successfully validated:

Chart Version Check Template Validation Dry-run Installation Overall Status
common ✅ Incremented ✅ Passed ✅ Passed ✅ Passed

Summary:

  • ✅ Charts tested: common
  • ✅ All template validations passed
  • ✅ All dry-run installations passed

📋 Detailed Information:

The PR is ready for review! 🚀

Note: Charts will be automatically released when this PR is merged to main.

@eskp eskp requested a review from a team January 5, 2026 06:43
@eskp eskp merged commit 58d1ff5 into main Jan 5, 2026
4 checks passed
@eskp eskp deleted the fix/service-account-name branch January 5, 2026 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant