Skip to content

[Backport 7.6.x] Fix grafana StatefulSet rendering with extraContainers and a service account (#924) - #925

Merged
marcleblanc2 merged 1 commit into
7.6.xfrom
backport-924-to-7.6.x
Aug 20, 2026
Merged

[Backport 7.6.x] Fix grafana StatefulSet rendering with extraContainers and a service account (#924)#925
marcleblanc2 merged 1 commit into
7.6.xfrom
backport-924-to-7.6.x

Conversation

@marcleblanc2

Copy link
Copy Markdown
Contributor

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:

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.

…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
marcleblanc2 requested a review from a team August 20, 2026 06:40
@marcleblanc2
marcleblanc2 enabled auto-merge (squash) August 20, 2026 06:40
@marcleblanc2
marcleblanc2 merged commit e3d8e79 into 7.6.x Aug 20, 2026
3 checks passed
@marcleblanc2
marcleblanc2 deleted the backport-924-to-7.6.x branch August 20, 2026 07:00
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.

2 participants