[Backport 7.6.x] Fix grafana StatefulSet rendering with extraContainers and a service account (#924) - #925
Merged
Merged
Conversation
…account (#924) The grafana StatefulSet template renders `serviceAccountName` between the `containers` list and `grafana.extraContainers`, so setting both a service account and `extraContainers` produces 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 ``` This moves the `extraContainers` block before `renderServiceAccountName`, 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. - [x] Follow the [manual testing process](https://github.com/sourcegraph/deploy-sourcegraph-helm/blob/main/TEST.md) - [x] Update [changelog](https://github.com/sourcegraph/deploy-sourcegraph-helm/blob/main/charts/sourcegraph/CHANGELOG.md) - [ ] Update [Kubernetes update doc](https://docs.sourcegraph.com/admin/updates/kubernetes) — not needed, no user-facing upgrade steps With test values setting both keys: ```yaml grafana: serviceAccount: create: false name: grafana-test-sa extraContainers: - name: test-sidecar image: busybox ``` - Before: `helm template sourcegraph charts/sourcegraph -f test-values.yaml` fails with the YAML parse error above - After: renders cleanly; parsed the StatefulSet with PyYAML and verified `spec.template.spec.serviceAccountName: grafana-test-sa` and `containers: [grafana, test-sidecar]` - Verified no other template renders `extraContainers` after `renderServiceAccountName` Co-authored-by: Amp <amp@ampcode.com> (cherry picked from commit e8fed45)
marcleblanc2
enabled auto-merge (squash)
August 20, 2026 06:40
filiphaftek
approved these changes
Aug 20, 2026
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.
Manual backport of #924 to
7.6.x(the automated backport failed on a CHANGELOG conflict).cc @sourcegraph/release
The grafana StatefulSet template renders
serviceAccountNamebetween thecontainerslist andgrafana.extraContainers, so setting both a service account andextraContainersproduces invalid YAML. This moves theextraContainersblock beforerenderServiceAccountName, 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.mdconflicted: the hunk context onmainincluded an unrelatedsearcher.autoCacheSizeentry that does not exist on7.6.x. Kept only the grafana bullet; the template change applied cleanly.Test plan
With test values setting both keys:
helm template sourcegraph charts/sourcegraph -f test-values.yaml -s templates/grafana/grafana.StatefulSet.yamlon this branch renders cleanly, withtest-sidecarinside thecontainerslist andserviceAccountName: grafana-test-saafter it.