Skip to content

Add grafana.initContainers for Airgapped Analytics - #941

Merged
marcleblanc2 merged 1 commit into
mainfrom
marc/grafana-init-containers
Sep 11, 2026
Merged

Add grafana.initContainers for Airgapped Analytics#941
marcleblanc2 merged 1 commit into
mainfrom
marc/grafana-init-containers

Conversation

@marcleblanc2

@marcleblanc2 marcleblanc2 commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Adding grafana.initContainers, so we can create a native sidecar using the aws-cli Docker image for Airgapped Analytics to work for customers using AWS RDS with IRSA authentication, without the Grafana pod crashing and rebooting twice before stabilizing. Follow-up to #924.

Checklist

Test plan

Tested with values:

grafana:
  serviceAccount:
    create: false
    name: grafana-irsa
  initContainers:
    - name: rds-token
      restartPolicy: Always
      image: public.ecr.aws/aws-cli/aws-cli:2.36.27
      startupProbe:
        exec:
          command: ["test", "-s", "/run/rds-token/password"]
        periodSeconds: 1
        failureThreshold: 60
      # ... writes /run/rds-token/password in a loop
  • helm template renders rds-token under spec.template.spec.initContainers with restartPolicy: Always, grafana alone under containers, and serviceAccountName: grafana-irsa
  • kubectl create --dry-run=server accepts the rendered StatefulSet on EKS 1.36
  • Default values (initContainers: []) render no initContainers key, so existing deployments are unchanged
  • helm unittest charts/sourcegraph: 137 passed; helm lint: clean
  • Verified the Grafana pod starts up without crashing

@marcleblanc2 marcleblanc2 changed the title Add grafana.initContainers for native sidecars Add grafana.initContainers for Airgapped Analytics Sep 5, 2026
@marcleblanc2
marcleblanc2 enabled auto-merge (squash) September 5, 2026 01:27
@marcleblanc2
marcleblanc2 requested a review from a team September 11, 2026 08:27
Grafana provisions datasources within ~1s of starting and exits if a
`$__file{}` referenced by datasources.yml doesn't exist yet. A sidecar
under `grafana.extraContainers` that writes that file races grafana on
pod start, and grafana crash-loops until the file appears.

`grafana.initContainers` lets the sidecar be a native sidecar init
container (`restartPolicy: Always`) with a startupProbe on the file, so
the kubelet holds grafana until the file is written.

Amp-Thread-ID: https://ampcode.com/threads/T-01a06eff-f826-72a5-9ee6-29e07f496a87
Co-authored-by: Amp <amp@ampcode.com>
@marcleblanc2
marcleblanc2 force-pushed the marc/grafana-init-containers branch from 921e2f9 to 7040487 Compare September 11, 2026 09:48
@marcleblanc2
marcleblanc2 merged commit 6425a94 into main Sep 11, 2026
5 checks passed
@marcleblanc2
marcleblanc2 deleted the marc/grafana-init-containers branch September 11, 2026 10:02
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