Repository navigation
ci(charts): a helm gate, and the selector check no schema could make - #452
Merged
Merged
Conversation
Contributor
terraform plan
|
There was no chart validation at all — zero hits for `helm lint`,
`helm template` or `kubeconform` across every workflow — while `images.yml`
triggers on `infra/k8s/**` and deploys chart changes straight into the `ci`
namespace. The first thing to evaluate a chart edit was the cluster.
plan-to-aws.md has listed this as unfinished since Phase 2.
Three steps of the ordinary kind — `helm lint`, then `helm template` +
`kubeconform -strict` over THREE profiles (the dev default, the kind profile
where `web.enabled: false` removes the BFF container and the drizzle hook, and
the namespace chart), because a template guarded by an `if` is unchecked in
every profile that disables it.
**And one step none of those can do.** `helm lint`, `helm template` and
`kubeconform` all answer "is each document well-formed". None answers:
does this selector match any pod that exists?
`allow-alb-to-web`'s `podSelector` said `app.kubernetes.io/name: er-web`, from
when the BFF was its own Deployment. After the pods were merged the only pod
carries `name: web-api`, so the policy matched NOTHING and the namespace's
`default-deny-ingress` would have blackholed the ALB the first time
`ingress.enabled` was flipped on. Every document was valid YAML, valid against
the Kubernetes schema and lint-clean. It was wrong for weeks. No single-chart
check could have seen it either: the policy is in `er-dev-namespace` and the pod
it selects is in `er-platform`.
So `scripts/ci/charts-check.py` renders both and intersects them, generalised to
the bug CLASS rather than the one instance — because the colour dimension is
about to add selectors meant to resolve to different pods, and the same mistake
would be invisible again:
1. every Service selector matches at least one rendered pod
2. every NetworkPolicy podSelector matches at least one rendered pod
(an empty selector is `default-deny-ingress`'s deliberate all-pods form, not
a finding)
3. the ALB ingress hole does NOT open the control plane's port
(3) is a security property rather than a correctness one. §4.1 says "er-api is
on no load balancer in any environment"; after the pod merge that holds only
because the hole is PORT-scoped, since the selector necessarily matches a pod
that also serves er-api on 8000. A reviewer widening the port list would
quietly publish the control plane and nothing else in the tree would notice.
Both renders force `ingress.enabled=true` and `webIngressFromVpc.enabled=true`.
The objects worth checking are exactly the ones that do not exist until someone
enables the edge — which is when nobody is reading this file.
**Observed failing in all three directions before being trusted:**
| state | result |
|---|---|
| against `main` today | exit 1, naming `allow-alb-to-web` as matching no pod |
| with the fix from the selector PR applied | exit 0 |
| pod `kind` renamed, so it examines nothing | exit **2**, refusing to report success |
The third is the property every gate here needs and the reason the second one
is not enough on its own.
Wiring notes, each of which is a rule rather than a preference:
- Gated on its own `charts` detect output, not on `infra`: a chart edit must not
trigger `terraform plan`, and a terraform edit must not pay for a render. Same
allowlist direction and the same `grep -c` (never `-q`, which can SIGPIPE
`git diff` under `pipefail` into a flaky false skip). Both of detect's
early-exit paths now set `charts` too — an unset output reads as `false` and
would silently skip the gate on exactly the fail-safe path that exists to
avoid silence.
- No `paths:` filter, because the workflow's jobs are required checks and a
workflow a path filter skips never reports.
- **NOT a required check in this PR**, and that order is not optional: a job's
`name:` IS its branch-protection context, so adding a context for a job that
has never reported green on `main` leaves every PR pending forever. Land it,
watch it report, then require it.
- helm and kubeconform install from version-pinned tarballs rather than
third-party actions, the choice `images.yml`'s helm install documents; PyYAML
is installed explicitly rather than assumed present, so a missing dependency
fails at a named step instead of becoming an import error inside a script.
This PR's gate is RED until the selector fix lands — that is the point, and the
honest demonstration. It goes green on the merge after.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
athvin
force-pushed
the
bm/bluegreen-p4-chart-gate
branch
from
November 3, 2026 05:51
8b23c44 to
4b33359
Compare
This was referenced Nov 5, 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.
There was no chart validation at all — zero hits for
helm lint,helm templateorkubeconformacross every workflow — whileimages.ymltriggers oninfra/k8s/**and deploys chart changes straight into thecinamespace. The first thing to evaluate a chart edit was the cluster.plan-to-aws.mdhas listed this as unfinished since Phase 2.Three steps of the ordinary kind
helm lint, thenhelm template+kubeconform -strictover three profiles — the dev default, the kind profile (web.enabled: false, so no BFF container and no drizzle hook), and the namespace chart. Three, because a template guarded by anifis unchecked in every profile that disables it.Both renders force
ingress.enabled=trueandwebIngressFromVpc.enabled=true. The objects worth checking are exactly the ones that don't exist until someone enables the edge — which is when nobody is reading this file.And one step none of those can do
helm lint,helm templateandkubeconformall answer "is each document well-formed". None answers:allow-alb-to-web'spodSelectorsaidapp.kubernetes.io/name: er-web, from when the BFF was its own Deployment. After the pods were merged the only pod carriesname: web-api, so the policy matched nothing — anddefault-deny-ingresswould have blackholed the ALB the first timeingress.enabledwas flipped. Every document was valid YAML, valid against the Kubernetes schema and lint-clean. It was wrong for weeks. No single-chart check could have seen it either: the policy is iner-dev-namespaceand the pod it selects is iner-platform.So
scripts/ci/charts-check.pyrenders both and intersects them — generalised to the bug class rather than the one instance, because the colour dimension is about to add selectors meant to resolve to different pods and the same mistake would be invisible again:default-deny-ingress's deliberate all-pods form, not a finding)(3) is a security property rather than a correctness one. §4.1 says "er-api is on no load balancer in any environment"; after the pod merge that holds only because the hole is port-scoped, since the selector necessarily matches a pod that also serves er-api on 8000. A reviewer widening the port list would quietly publish the control plane and nothing else in the tree would notice.
Observed failing in all three directions before being trusted
mainbefore #443allow-alb-to-webas matching no podkindrenamed so it examines nothingThe third is the property every gate here needs, and the reason the second isn't enough on its own.
That run is why this PR is rebased on top of #443 rather than independent of it: the gate was written before the fix, found the fix's bug on its own, and goes green on the merge after.
Wiring notes, each a rule rather than a preference
chartsdetect output, not oninfra: a chart edit must not triggerterraform plan, and a terraform edit must not pay for a render. Same allowlist direction and the samegrep -c(never-q, which can SIGPIPEgit diffunderpipefailinto a flaky false skip). Both of detect's early-exit paths now setchartstoo — an unset output reads asfalseand would silently skip the gate on exactly the fail-safe path that exists to avoid silence.paths:filter, because this workflow's jobs are required checks and a workflow a path filter skips never reports.name:is its branch-protection context, so adding a context for a job that has never reported green onmainleaves every PR pending forever. Land it, watch it report, then require it.images.yml's helm install documents. PyYAML is installed explicitly rather than assumed present, so a missing dependency fails at a named step instead of becoming an import error inside a script.ci-and-supply-chain/references/required-checks.mdis regenerated in the same commit, since adding a workflow job makes it stale and its drift check runs inside the requiredfmt + clippy + docsjob.Verification
make checkgreen.kubeconformreports 15 valid / 2 skipped on the dev profile; the skips are the ExternalSecret CRD, which has no published schema. That's a real gap — a typo in a CRD'skindwould be skipped rather than caught — which is why the step prints the skipped count rather than hiding it, and why the selector gate checks relationships no schema could express anyway.🤖 Generated with Claude Code