Skip to content

sourcegraph: add extraInitContainers and extraServicePorts to every component - #991

Open
marcleblanc2 wants to merge 1 commit into
mainfrom
marc/extra-init-containers-service-ports
Open

marcleblanc2 wants to merge 1 commit into
mainfrom
marc/extra-init-containers-service-ports

Conversation

@marcleblanc2

@marcleblanc2 marcleblanc2 commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Problem

  • A customer migrating from Kustomize to Helm needs two things the chart cannot do today: init containers on any pod, and extra ports on Services. See the Slack thread

Solution

  • <serviceName>.extraInitContainers on all 21 workloads

    • Rendered before any init container the chart defines
  • <serviceName>.extraServicePorts appended to each component's primary Service

  • Both are toYaml passthrough lists that render nothing when unset

  • grafana.initContainers is replaced by grafana.extraInitContainers

  • The secondary Services sourcegraph-frontend-internal, indexed-search-indexer, and worker-executors do not get extraServicePorts. Frontend-internal already listens on port 80, so an extra port 80 on frontend would otherwise collide with it

Tested

  • New tests/extraInitContainersServicePorts_test.yaml sets both values on every component at once and asserts: the extra init container is index 0 on all 21 workloads and the chart's own init container is index 1 where it has one, no initContainers key renders by default, the port is appended on all 20 primary Services, and the 3 secondary Services are unchanged

  • helm unittest charts/sourcegraph: 38 suites, 234 tests pass. helm lint clean. ./scripts/helm-docs.sh leaves no diff. helm template with default values is byte-identical to origin/main

  • kubeconform -strict passes on the default render and on a render with both values set across frontend, otel, grafana, worker, and pgsql

  • Deployed to a test instance on EKS with both values set on every deployed component: frontend, gitserver, grafana, indexed-search, precise-code-intel-worker, prometheus, searcher, syntect-server, worker

    • Every pod ran its extra init container to Completed; kubectl logs <pod> -c extra-init-check shows its output on each

    • On frontend, the extra init container ran before migrator, and a file it wrote to an extraVolumes emptyDir is readable from the frontend container

    • On grafana, a real native sidecar (restartPolicy: Always, mints RDS IAM auth tokens) runs through grafana.extraInitContainers

    • Every primary Service shows the extra port, and curl from another pod in the namespace returns 200 through it on frontend, grafana, prometheus, syntect-server, and worker

    • All pods Ready, site healthy

Amp threads

Changelog

  • Added <serviceName>.extraInitContainers to every workload
  • Added <serviceName>.extraServicePorts to every component's primary Service

Checklist

@github-actions

Copy link
Copy Markdown

@marcleblanc2
marcleblanc2 force-pushed the marc/extra-init-containers-service-ports branch from 16a4b6d to 33601c6 Compare October 31, 2026 04:31
@marcleblanc2
marcleblanc2 requested a review from a team October 31, 2026 04:31
@marcleblanc2
marcleblanc2 marked this pull request as draft October 31, 2026 04:34
…omponent

Add `<serviceName>.extraInitContainers` to all 21 workloads, rendered
before any init containers the chart defines, so a user-supplied init
container (e.g. one that fetches database credentials from Vault) runs
before `migrator` on frontend. The grafana-only `initContainers` key is
replaced by the same `extraInitContainers` block the other components use.

Add `<serviceName>.extraServicePorts` to each component's primary
Service. The secondary `sourcegraph-frontend-internal`,
`indexed-search-indexer`, and `worker-executors` Services are left
unchanged so an extra port 80 on frontend does not collide with
frontend-internal's existing port 80.

Both values are passthrough `toYaml` lists and default to unset; the
default render is unchanged.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1902b-ece9-725c-863d-3e2bba35ee1d
Co-authored-by: Amp <amp@ampcode.com>
@marcleblanc2
marcleblanc2 force-pushed the marc/extra-init-containers-service-ports branch from 33601c6 to 799e5fe Compare November 4, 2026 10:05
@marcleblanc2
marcleblanc2 marked this pull request as ready for review November 4, 2026 10:05
@marcleblanc2
marcleblanc2 enabled auto-merge (squash) November 4, 2026 10:12

@filiphaftek filiphaftek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I run agent to search for breaking change, but looks good :+1

This branch has not been deployed

No deployments
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