[Issue#21344]: avoid migration hook serviceaccount dependency cycle - #21405
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR fixes a Helm chart cyclic dependency (Issue #21344) that occurred when
Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| deploy/charts/litellm-helm/templates/_helpers.tpl | New litellm.migrationServiceAccountName helper added to resolve service account for migration jobs, avoiding cyclic dependency when Helm hooks are enabled alongside serviceAccount.create=true. Logic is correct and well-documented with an inline comment. |
| deploy/charts/litellm-helm/templates/migrations-job.yaml | Single-line change replacing litellm.serviceAccountName with litellm.migrationServiceAccountName. Clean and minimal change that correctly delegates to the new helper. |
| deploy/charts/litellm-helm/tests/migrations-job_tests.yaml | Three new Helm unit tests covering: default fallback to default SA, explicit override, and existing behavior preservation. Also fixes a missing newline at end of file. Could benefit from one additional test for helm.enabled=true with serviceAccount.create=false. |
| deploy/charts/litellm-helm/values.yaml | New migrationJob.serviceAccountName field with clear documentation about when it is used. Default empty string correctly triggers fallback to "default" in the helper template. |
Flowchart
flowchart TD
A[migrations-job.yaml] -->|calls| B["litellm.migrationServiceAccountName"]
B --> C{"helm.hooks.enabled AND\nserviceAccount.create?"}
C -->|Yes| D{"migrationJob.serviceAccountName\nset?"}
D -->|Yes| E["Use migrationJob.serviceAccountName"]
D -->|No / empty| F["Use 'default' SA"]
C -->|No| G["litellm.serviceAccountName"]
G --> H{"serviceAccount.create?"}
H -->|Yes| I["Use chart fullname SA"]
H -->|No| J{"serviceAccount.name set?"}
J -->|Yes| K["Use serviceAccount.name"]
J -->|No| L["Use 'default' SA"]
Last reviewed commit: 7644217
| - it: should use chart service account when helm hooks are disabled | ||
| template: migrations-job.yaml | ||
| set: | ||
| migrationJob: | ||
| enabled: true | ||
| hooks: | ||
| helm: | ||
| enabled: false | ||
| serviceAccount: | ||
| create: true | ||
| name: my-custom-sa | ||
| asserts: | ||
| - equal: | ||
| path: spec.template.spec.serviceAccountName | ||
| value: my-custom-sa |
There was a problem hiding this comment.
Consider adding a test for pre-existing SA with hooks
The tests cover the three main scenarios well. One additional edge case worth testing: helm.enabled=true with serviceAccount.create=false and an explicit serviceAccount.name. In this case, the SA already exists (not managed by the chart), so there's no cyclic dependency and the helper should pass through the pre-existing SA name rather than falling back to default. This would confirm the else branch of the new helper behaves correctly when hooks are active but the SA isn't chart-managed.
- it: should use pre-existing service account when helm hooks are enabled but serviceAccount.create is false
template: migrations-job.yaml
set:
migrationJob:
enabled: true
hooks:
helm:
enabled: true
serviceAccount:
create: false
name: pre-existing-sa
asserts:
- equal:
path: spec.template.spec.serviceAccountName
value: pre-existing-saNote: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
Updated the tests to handle above mentioned issue.
5e24937
into
BerriAI:litellm_oss_staging_03_04_2026
…erriAI#21405) * helm cyclic dependency fix * updating test case for handling edge cases
Relevant issues
Fixes #21344
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
tests/litellm/directory, Adding at least 1 test is a hard requirement - see detailsmake test-unit@greptileaiand received a Confidence Score of at least 4/5 before requesting a maintainer reviewCI (LiteLLM team)
Branch creation CI run
Link:
CI run for the last commit
Link:
Merge / cherry-pick CI run
Links:
Type
🐛 Bug Fix
✅ Test
Changes
- default fallback to default SA in hook mode.
- explicit migration SA override in hook mode