fix(k8s): validate kustomize build output in CI, remove dead components key - #490
Open
TheWeirdDee wants to merge 4 commits into
Open
fix(k8s): validate kustomize build output in CI, remove dead components key#490TheWeirdDee wants to merge 4 commits into
TheWeirdDee wants to merge 4 commits into
Conversation
…ts key pdb.yaml was already wired into kustomization.yaml's resources (an earlier commit fixed that half), but three things from Stellar-Search#322 were still open: - The empty `components:` key (comments, no items) is removed. Kustomize components compose partial patches into a base; k8s/scheduler/ ships its own Namespace and RBAC, so it's a full standalone base, not a component — listing it there would have been structurally wrong even populated. It's documented instead as a separate Kustomization applied on its own. - scripts/check-k8s-manifests.py now runs its Ingress-backend, PDB-selector, and NetworkPolicy-admission checks against actual `kustomize build k8s/` output instead of manually re-parsed source files, so a selector broken by the namespace transform, a patch, or a future component would still be caught. Verified by reintroducing both defects it targets (an unwired pdb.yaml, a PDB selector matching no workload) and confirming each fails. - CI never ran `kustomize build` or a schema validator, so a rendering error was invisible until `kubectl apply` hit it in a real cluster. Adds a k8s-manifests job to ci.yml that installs kustomize and kubeconform (SHA256-pinned downloads) and runs `kustomize build | kubeconform -strict` against both k8s/ and k8s/scheduler/, plus the Python script above. The community CRD schema catalog is wired in alongside kubeconform's built-in schemas, since k8s/ renders Argo Rollouts CRDs (Rollout, AnalysisTemplate) that kubeconform doesn't recognize out of the box. Also fixes a stale docs/deployment-mainnet.md reference to k8s/ingress.yaml, which no longer exists — Ingress is now defined inline in backend.yaml and frontend.yaml, with no TLS block, matching what's actually there. Verified locally: `kustomize build k8s/` renders all 4 PDBs with selectors matching real workloads, kubeconform passes 37/37 resources for k8s/ and 10/10 for k8s/scheduler/, and check-k8s-manifests.py passes end-to-end against the built output.
AbuJulaybeeb
requested changes
Aug 25, 2026
AbuJulaybeeb
left a comment
Contributor
There was a problem hiding this comment.
KIndly fetch upstream, rebase and push for merge
Emmy123222
requested review from
AbuJulaybeeb and
Emmy123222
and removed request for
AbuJulaybeeb
August 30, 2026 11:40
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.
Summary
Closes #322.
An earlier commit (
6caaa40) had already wiredpdb.yamlintok8s/kustomization.yaml'sresources:and folded the standaloneingress.yamlintobackend.yaml/frontend.yaml, plus addedscripts/check-k8s-manifests.pyfor cluster-free static checks. This PR closes the three gaps that were still open against the issue's acceptance criteria:1. The empty
components:key. Removed. A Kustomizecomponentcomposes partial patches into a base;k8s/scheduler/ships its ownNamespaceand RBAC, so it's a full standalone base, not a component — it would have been structurally wrong to list it there even if populated. Documented instead as a separate Kustomization, applied on its own (kubectl apply -k k8s/scheduler/), in a comment at the top of the file. Also fixed a since-contradictory comment abovepdb.yamlthat still said "never referenced here" while sitting right next to its ownresources:entry.2. PDB-selector checks ran against raw source files, not "the built output."
scripts/check-k8s-manifests.py's Ingress-backend, PDB-selector, and NetworkPolicy-admission checks now run against actualkustomize build k8s/output (viasubprocess) instead of manually re-parsing the referenced source files. This is strictly more correct — it would catch a selector or label broken by the namespace transform, a patch, or a future component, none of which the old source-parsing approach could see. Verified by reintroducing both defects the script targets (an unwiredpdb.yaml, a PDB selector matching no workload) and confirming each fails with the right message.3. No CI job ran
kustomize buildor a schema validator. Added ak8s-manifestsjob toci.ymlthat installskustomizev5.8.1 andkubeconformv0.8.0 (SHA256-pinned downloads, same pattern as the existing gitleaks install insecret-scanning.yml) and runskustomize build | kubeconform -strictagainst bothk8s/andk8s/scheduler/, then runs the Python script above. Wired in the community CRD schema catalog (datreeio/CRDs-catalog) alongside kubeconform's built-in schemas, sincek8s/renders Argo Rollouts CRDs (Rollout,AnalysisTemplate) that kubeconform doesn't recognize out of the box — without it,-strictfails those two kinds as unrecognized even though they're valid.Also fixed a stale
docs/deployment-mainnet.mdreference tok8s/ingress.yaml, which no longer exists (removed in6caaa40) — the doc still described atlsblock that isn't in the current inline Ingress definitions either.Deployment-path authority:
docs/deployment-mainnet.mdalready statesk8s/*.yamlare local/dev-only and Helm is authoritative for real environments (testnet/Mainnet) — I carried that into a comment at the top ofk8s/kustomization.yamlitself so it's visible from the manifest, not just the doc.k8s/scheduler/andml-workloads/have no Helm templates at all, so they remain kustomize-only regardless.Test plan
kustomize build k8s/— renders cleanly, all 4 PDBs present with selectors matching real workload pod labels (backend,frontend,ml-inference,summary-worker)kustomize build k8s/scheduler/— renders cleanly (10 resources: Namespace, ServiceAccount, ClusterRole(Binding), Role(Binding), ConfigMap, Deployment, 2× NetworkPolicy)kustomize build k8s/ | kubeconform -strict -summary -schema-location default -schema-location <CRDs-catalog>— 37/37 valid, 0 errorskustomize build k8s/scheduler/ | kubeconform -strict -summary ...— 10/10 valid, 0 errorspython3 scripts/check-k8s-manifests.py(withkustomizeonPATH) — passes against current statepdb.yamldefect → script fails withk8s/pdb.yaml is not referenced by kustomization.yaml; revertedapp: nonexistent-workload) → script fails withPodDisruptionBudget backend-pdb selects {...}, which matches no workload; revertedkustomize build k8s/output is byte-identical before/after thecomponents:/comment cleanup inkustomization.yaml(doc-only change, confirmed no behavior change)kustomize/kubeconformLinux binaries the new CI job installs, matching the checksums published in each project's releaseactionlintv1.7.12 againstci.yml— exits 0