Fix grafana StatefulSet rendering with extraContainers and a service account - #924
Merged
Merged
Conversation
…account
The grafana StatefulSet template rendered serviceAccountName between the
containers list and grafana.extraContainers, so setting both a service
account and extraContainers produced invalid YAML:
Error: YAML parse error on
sourcegraph/templates/grafana/grafana.StatefulSet.yaml: error
converting YAML to JSON: yaml: line 94: did not find expected key
Emit extraContainers inside the containers list before
serviceAccountName, matching the ordering every other template uses
(e.g. gitserver.StatefulSet.yaml).
Amp-Thread-ID: https://ampcode.com/threads/T-01a01d78-960e-7559-9ae0-cfb8bb51fff1
Co-authored-by: Amp <amp@ampcode.com>
marcleblanc2
enabled auto-merge (squash)
August 20, 2026 06:16
michaellzc
approved these changes
Aug 20, 2026
Collaborator
|
The backport to To backport this PR manually, you can either: Via the sg toolUse the sg backport -r 7.6.x -p 924Via your terminalTo backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-7.6.x 7.6.x
# Navigate to the new working tree
cd .worktrees/backport-7.6.x
# Create a new branch
git switch --create backport-924-to-7.6.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 e8fed45af40538315e049ecf9080ea8d8e5b2494
# Push it to GitHub
git push --set-upstream origin backport-924-to-7.6.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-7.6.xIf you encouter conflict, first resolve the conflict and stage all files, then run the commands below: git cherry-pick --continue
# Push it to GitHub
git push --set-upstream origin backport-924-to-7.6.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-7.6.x
Once the pull request has been created, please ensure the following:
|
marcleblanc2
added a commit
that referenced
this pull request
Aug 20, 2026
…rs and a service account (#924) (#925) Manual backport of #924 to `7.6.x` (the automated backport failed on a CHANGELOG conflict). cc @sourcegraph/release The grafana StatefulSet template renders `serviceAccountName` between the `containers` list and `grafana.extraContainers`, so setting both a service account and `extraContainers` produces invalid YAML. This moves the `extraContainers` block before `renderServiceAccountName`, matching the ordering every other template uses. This fix is required for customers using the Airgapped Analytics dashboard, with AWS IAM (IRSA) authentication to their Postgres database in RDS. ### Conflict resolution Only `charts/sourcegraph/CHANGELOG.md` conflicted: the hunk context on `main` included an unrelated `searcher.autoCacheSize` entry that does not exist on `7.6.x`. Kept only the grafana bullet; the template change applied cleanly. ### Test plan With test values setting both keys: ```yaml grafana: serviceAccount: create: false name: grafana-test-sa extraContainers: - name: test-sidecar image: busybox ``` `helm template sourcegraph charts/sourcegraph -f test-values.yaml -s templates/grafana/grafana.StatefulSet.yaml` on this branch renders cleanly, with `test-sidecar` inside the `containers` list and `serviceAccountName: grafana-test-sa` after it. Co-authored-by: Amp <amp@ampcode.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The grafana StatefulSet template renders
serviceAccountNamebetween thecontainerslist andgrafana.extraContainers, so setting both a service account andextraContainersproduces invalid YAML:This moves the
extraContainersblock beforerenderServiceAccountName, matching the ordering every other template uses (e.g.gitserver.StatefulSet.yaml). Grafana is the only template with this misordering.This fix is required for customers using the Airgapped Analytics dashboard, with AWS IAM (IRSA) authentication to their Postgres database in RDS.
Checklist
Test plan
With test values setting both keys:
helm template sourcegraph charts/sourcegraph -f test-values.yamlfails with the YAML parse error abovespec.template.spec.serviceAccountName: grafana-test-saandcontainers: [grafana, test-sidecar]extraContainersafterrenderServiceAccountName