Skip to content

Manifest CI

Every pull request in Skatzi/platform runs the CI Manifests workflow (.gitea/workflows/ci-manifests.yaml). Its job, render-and-validate, proves that the manifests render and validate, and posts the rendered diff to the pull request. The Renovate ADR asks for it as the pre-merge gate for platform upgrades (§10).

The job name stays render-and-validate, so branch protection can require it as a status check.

What it checks

  1. Render. scripts/render-manifests.py renders every cluster/<name>/ path the way Flux applies it:
    • kustomize build of the cluster root, then of every Flux Kustomization it finds there and in what those render, with their spec.patches;
    • Flux postBuild variable substitution: substitute values, and placeholder values for the cluster-config ConfigMap, which Terraform creates. Resources annotated kustomize.toolkit.fluxcd.io/substitute: disabled are left alone, $var is not substituted and $${var} gives ${var}, as in Flux;
    • a Flux Kustomization's spec.targetNamespace, set on every namespaced resource it renders (overriding any namespace already there), while cluster-scoped kinds are left alone;
    • helm template of every HelmRelease, at its chart version, with its values, CRDs included. The chart is downloaded first with helm pull, tried 3 times (waiting 5 s, then 10 s), because chart hosts such as helm.goharbor.io sometimes drop the connection. A host that stays down still fails the render with its error.
  2. Validate. kubeconform -strict checks everything the render produced. Custom resources are checked against the CRDs in the render itself, so they match the CRD versions the pull request deploys. Kinds that no rendered CRD defines fall back to the Kubernetes schemas and the datreeio CRDs catalog. The CRD objects themselves are not schema-checked: no upstream schema exists for them.
  3. Gate Job inputs. scripts/check-gate-inputs.py reads the render. For every Flux Kustomization whose healthChecks name a Job (a pre-upgrade backup gate, a smoke check), each ConfigMap and Secret the Job mounts (volumes, envFrom, valueFrom) must be applied by that same Kustomization or by one it dependsOn, transitively. An object applied by a Kustomization that depends on the gate reaches the cluster only after the gate has run, so the gate runs with the old copy (incident 2026-10-24). A Job named in healthChecks that the Kustomization does not render is an error too. An ExternalSecret or ClusterExternalSecret counts as applying its Secret. A reference the Job marks optional: true and that cannot come first (a Secret synced from OpenBao for the OpenBao gate, a ConfigMap another Job writes) is listed with a one-line reason in EXCEPTIONS at the top of the script. A gate whose source is a GitRepository outside this repository (the image gates of Taskbase and Emiliero, taskbase-<env>-preupgrade and emiliero-preupgrade) is not rendered, so it is listed as not checked: its Job and the inputs it mounts are in that repository. Its unit tests, scripts/test_check_gate_inputs.py, run in the same step.
  4. OpenBao images. scripts/check-openbao-images.py reads the render. In a cluster that runs OpenBao, every quay.io/openbao/openbao image in a pod template in the openbao and openbao-drill namespaces, and every TARGET_IMAGE there, must equal the server image of the rendered openbao/openbao StatefulSet, which is the chart's appVersion (see Upgrading OpenBao). Its unit tests, scripts/test_check_openbao_images.py, run in the same step.
  5. Diff. The base branch (the merge base) is rendered by the same script, and the diff per cluster path is posted as one pull-request comment, which every push updates. CRD changes get their own diff. Long diffs are cut in the comment; the full diff is in the job log.

The check fails when a render, validation, gate input or OpenBao image check fails. It does not fail on a diff.

What it does not cover

  • Flux Kustomizations whose source is another repository (Taskbase, Emiliero, Botyard). The render notes in the comment list them as skipped.
  • HelmRelease valuesFrom, postRenderers other than kustomize patches and images, and substituteFrom other than cluster-config: the script stops with an error when it meets one, so support can be added when it is first used. Kustomize post-renderers are applied in order to the rendered chart, as helm-controller does (OpenBao's, #3377), but here also to the chart's crds/, which helm-controller leaves out.
  • Chart versions given as a range (such as >=65.0.0) render the newest matching chart, so the diff can change when upstream releases one.
  • Secret values, and the checksum/secret* annotations computed from them, are shown as REDACTED: some charts generate random secrets, which would otherwise change every render.

Placeholder values

The placeholder cluster-config values live in the CLUSTERS table at the top of scripts/render-manifests.py, with whether the cluster's bootstrap Kustomization substitutes the root path. A new cluster/<name>/ directory fails the render until it has an entry there. A variable that is neither set nor a placeholder fails the render of that Kustomization, naming the variable, the resource and the Kustomization path, unless it has a default (${var:=}) or is escaped ($${var}). Flux 2.9 does the same (StrictPostBuildSubstitutions): it fails the reconciliation instead of substituting an empty string.

Running it locally

You need Python 3 with PyYAML, kustomize, helm and kubeconform (the versions are pinned at the top of the workflow). The agent-runner chart is private in Harbor. For a local render without a prior Helm login, use a kubectl context with permission to read the harbor-pull-secret in the management cluster's agent-runners namespace (see Kubernetes access):

python3 scripts/render-manifests-local.py . /tmp/render/head

The helper reads the existing cluster pull secret, passes its password to helm registry login on standard input, renders with scripts/render-manifests.py, and removes its temporary Helm registry config afterward. It never prints the secret or writes credentials into this repository. If you already have a Harbor login in Helm, run scripts/render-manifests.py directly instead.

With either method, validate the render:

curl -sSfLO https://raw.githubusercontent.com/yannh/kubeconform/v0.6.7/scripts/openapi2jsonschema.py
mkdir -p /tmp/render/schemas
(cd /tmp/render/schemas && FILENAME_FORMAT='{fullgroup}-{kind}_{version}' \
  python3 "$OLDPWD/openapi2jsonschema.py" /tmp/render/head/*/crds/*.yaml > /dev/null)
# Match CI: remove the invalid `additionalProperties` flag nested inside a CRD field named `properties`.
python3 - /tmp/render/schemas <<'PY'
import glob, json, sys

def fix(node, in_props=False):
    if isinstance(node, dict):
        if in_props and node.get("additionalProperties") is False:
            del node["additionalProperties"]
        for key, value in node.items():
            fix(value, key == "properties")
    elif isinstance(node, list):
        for value in node:
            fix(value)

for path in glob.glob(sys.argv[1] + "/*.json"):
    with open(path) as f:
        schema = json.load(f)
    fix(schema)
    with open(path, "w") as f:
        json.dump(schema, f)
PY
kubeconform -strict -summary -skip CustomResourceDefinition \
  -schema-location '/tmp/render/schemas/{{.Group}}-{{.ResourceKind}}_{{.ResourceAPIVersion}}.json' \
  -schema-location default \
  -schema-location 'https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/{{.Group}}/{{.ResourceKind}}_{{.ResourceAPIVersion}}.json' \
  /tmp/render/head

# Diff against main
git worktree add /tmp/render/base-tree "$(git merge-base HEAD origin/main)"
python3 scripts/render-manifests-local.py /tmp/render/base-tree /tmp/render/base
diff -ruN /tmp/render/base /tmp/render/head

# Gate Job inputs
python3 scripts/check-gate-inputs.py /tmp/render/head

# OpenBao images
python3 scripts/check-openbao-images.py /tmp/render/head

The output has one file per Flux Kustomization: <cluster>/<kustomization>.yaml with its manifests and rendered charts, and <cluster>/crds/<kustomization>.yaml with its CRDs.