ci(flux): every overlay is built, and the CRDs are checked against real schemas - #1323
Merged
Merged
Conversation
…al schemas The job built four of the eight overlays, named in a list beside the eight the cluster applies, so apps/stateless, apps/data, apps/mail and apps/vso-secrets could merge without CI ever rendering them. The list is now derived from the Flux Kustomization CRs, so what CI builds and what the cluster applies cannot drift, and a directory that builds but that no CR applies is reported rather than ignored. Rendering only proved the YAML parsed. kubeconform now validates the output against the CRD schemas the charts install — Flagger, Traefik, VSO, cert-manager and Flux itself — with -strict, so a misspelled key fails the build instead of becoming a field the cluster silently drops. kubeconform skips a resource it has no schema for and says nothing, so kinds that must be checked are listed and a skip among them is an error. A --self-test mode runs a deliberately broken Canary through the same validator and fails if it passes, because a validator that has quietly stopped validating is green on everything.
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.
Closes #1292. Part of #1289.
flux-kustomize-checkbuilt four overlays, named in a hardcoded list, while the cluster applies eight.apps/stateless,apps/data,apps/mailandapps/vso-secretswere never rendered, so a manifest in any of them could merge without CI having built it once. What it did build, it only built: rendering proves the YAML parses and says nothing about whether a CRD field exists.What this achieves
Every overlay Flux applies is built, and the rendered objects are validated against the CRD schemas the charts install — Flagger, Traefik, VSO, cert-manager and Flux's own.
The overlay list is derived from the
spec.pathof every Flux Kustomization CR rather than written down beside it, so what CI builds and what the cluster applies cannot drift. A directory that builds but that no Kustomization CR applies is reported: it is either dead or about to be applied by nobody.How
scripts/check-flux-manifests.sh, followingcheck-migration-order.sh's example of putting the logic in a script rather than in the workflow, so it can be run locally.kubeconform -strictagainst the datreeio CRDs-catalog;-strictis what turns a misspelled key into a failed build rather than a field the cluster silently drops.The trap worth knowing about: kubeconform skips a resource it has no schema for, and says nothing. A lost schema location or one
-ignoreflag too many yields a green run in which nothing was checked. Two things guard that. Kinds that must be checked are listed explicitly, and a skip among them is an error rather than a notice. And--self-testpushes a deliberately broken Canary through the same validator and fails if it passes — the fixture lives in the script rather than in the Flux tree, where an intentionally invalid Canary would read as a mistake.The check also prints every kind it validated and every kind it skipped, so the coverage is visible in the log rather than assumed.
Not in scope
Schemas are fetched from
raw.githubusercontent.comon each run and not cached, which adds a network dependency to every pull request. Worth a cache if it ever flakes; not worth the moving parts before then.CustomResourceDefinitionhas no schema in the catalog, so the eleven in Flux's vendoredgotk-components.yamlare reported as unchecked. That file is generated byflux bootstrap, not hand-edited, so it is not in the required-kind list.Worth a reviewer's attention
Validate completegate and any branch protection keyed to it are untouched. Only its display name changed, fromFlux kustomize buildtoFlux manifests, since it now does more than build.mainthat notice currently readsCanary— correct, because the Canaries are in feat(platform): the site's images name a version, and Flagger promotes the pair #1316 and not merged. Once that lands the notice goes away andCanarybecomes a validated kind.kubeconformis pinned tov0.8.0and installed bycurl | tarrather than an action, matching how the job already installskubectl.Verification
Run locally in both modes against the real tree. Eight overlays build, 22 kinds validate — including
IngressRoute,Middleware,TLSStore,VaultStaticSecret,HelmRelease,CertificateandKustomization.Each acceptance criterion was demonstrated with a deliberate break, then reverted:
a Kustomization CR points at … which does not existentryPointsmisspelled asentryPointzin the realapi.yamladditional properties 'entryPointz' not allowed--self-testCanary, run against the validatorEvery schema the required-kind list names was confirmed to resolve in the catalog before relying on it.
Diff breakdown —
█added░removed, scaled to the largest row.