Repository navigation
ci: render charts with exhaustive test values through kubeconform and kustomize - #1034
Draft
marcleblanc2 wants to merge 3 commits into
Draft
marcleblanc2 wants to merge 3 commits into
marcleblanc2 wants to merge 3 commits into
Conversation
Helm emits a map key twice when a label or annotation is set at both the global and the component level. Helm and kubectl accept that, but kustomize rejects it, which breaks anyone who runs kustomize over the chart. Add tests/kustomizeRender_*.yaml values files for each chart, shaped like Sourcegraph Cloud and self-hosted deployments, and a workflow that renders each chart with them and builds the output with kustomize. Helm comes from .tool-versions, as on Buildkite. kustomizeRender_labelOverrides.yaml fails on main until the chart deduplicates these keys. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a2140d-bf64-751f-9812-0c8757baf6fd
Add tests/kustomizeRender_allValues*.yaml for each chart. Together they set every value the templates read to a non-default value, with alternate files for either-or choices, such as existing Secrets, ingress host lists, and external services. Label and annotation keys differ at each level, so a duplicate key in these renders is a template bug. kustomize-render.sh now also validates each render with kubeconform -strict, as the Buildkite schema step does for default values, and fails on Go template output such as map[ or <no value> in the manifests. On main, these find: - sourcegraph: jaeger.serviceAccount.create fails to render - sourcegraph: openTelemetry.agent.env renders invalid YAML - sourcegraph-executor-dind: privateDockerRegistry.serviceAnnotations renders invalid YAML Amp-Thread-ID: https://ampcode.com/threads/T-01a2140d-bf64-751f-9812-0c8757baf6fd Co-authored-by: Amp <amp@ampcode.com>
…files Checkov's CKV_SECRET_6 flags the placeholder Secret names and passwords in tests/kustomizeRender_*.yaml. They are not secrets, so skip the check on those lines, the way alert 347 on frontendIngress_test.yaml was dismissed as used in tests. Amp-Thread-ID: https://ampcode.com/threads/T-01a2140d-bf64-751f-9812-0c8757baf6fd Co-authored-by: Amp <amp@ampcode.com>
This was referenced Nov 25, 2026
This branch has not been deployed
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.
Problem
Our charts have templates that break as soon as a customer sets a documented value, and CI never notices. Buildkite only validates the charts rendered with their default values, and nothing checks the output the way customers consume it. Sourcegraph Cloud and customers who post-process the chart run kustomize over it, and kustomize rejects YAML that Helm accepts, such as a label key repeated in one map.
This PR's check current fails on
main; each item below is a value a customer can set today that breaks their deploy.jaeger.serviceAccount.create: truefails withindex of nil pointer:jaeger.ServiceAccount.yamlpasses"tracing", which is not a values keysourcegraph/tests/kustomizeRender_allValues.yaml,allValuesAlternate.yamlopenTelemetry.agent.envrenders invalid YAML:value:is indented undername:sourcegraph/tests/kustomizeRender_allValues.yaml, masked by the problem aboveprivateDockerRegistry.serviceAnnotationsrenders invalid YAML:annotations:is indented 4 spaces instead of 2sourcegraph-executor/dind/tests/kustomizeRender_allValues.yaml.tool-versions, accepts the duplicates; newer versions reject themsourcegraph/tests/kustomizeRender_labelOverrides.yamlA one-off scan during development also found documented values that render nothing. They are not part of this check:
sourcegraph.serviceLabelsredisStore.serviceAccount.annotationsjaeger.extraSelectorLabelsstorageClass.allowVolumeExpansion: false, which renderstruesourcegraph-executor/k8s:sourcegraph.labels,sourcegraph.nodeSelector,sourcegraph.affinity,sourcegraph.tolerations,executor.securityContext.privilegedsourcegraph-executor/dind:storageClass.*,executor.maximumNumJobsSolution
New GitHub Actions job Render charts through kustomize (
.github/workflows/kustomize_render.yml) runsscripts/ci/kustomize-render.sh. For everycharts/**/tests/kustomizeRender_*.yaml, it runshelm template, then:kubeconform -strict: catches values rendered in the wrong place or with the wrong typemap[,%!, or<no value>in the manifestskubectl kustomize: catches YAML that kustomize rejects, such as duplicate keysHelm and kubeconform come from
.tool-versionsthroughjdx/mise-action, the same versions Buildkite uses. kubectl comes with the runner image.The test values files sit next to the helm-unittest suites in each chart's
tests/directory. helm-unittest only loads*_test.yaml, so it ignores them. Each file starts with a header naming this CI job, and all names and endpoints are placeholders.kustomizeRender_sourcegraphCloud.yaml,kustomizeRender_selfHosted.yaml: shaped like Sourcegraph Cloud and common self-hosted deploymentskustomizeRender_allValues.yaml, plusallValuesAlternateandallValuesExternalServiceswhere a chart has either-or choices: set every value the templates read to a non-default value. Label and annotation keys differ at each level, so a duplicate key in these renders is a template bug.kustomizeRender_labelOverrides.yaml: the same label key at the global and component levels, where the component value should winChecklist
Test plan
Ran
scripts/ci/kustomize-render.shlocally with Helm 4.3 and kubeconform 0.8.0, and in this PR's CI run with the.tool-versionsversions. Both fail on the same 4 files:kustomizeRender_sourcegraphCloud.yaml, everykustomizeRender_selfHosted.yaml,allValuesExternalServices.yaml, and the executor and migrator files other than dindallValuespass all three checks.allValuesfile passes all three checks, so nothing else is hiding behind them.helm unittest(281 tests) andscripts/ci/lint.shpass, and./scripts/helm-docs.shchanges nothing.Linked PRs
jaeger.ServiceAccount.yamlrender failure, and deduplicates the label keys thatkustomizeRender_labelOverrides.yamlrepeatsAmp threads