Repository navigation
Description
Update 2026-11-26 (infra move): the environment manifests, such as k8s/llm/gateway-db.yaml, are in dan-petty/homelab, which validates them with kubeconform through the shared k8s-validate.yml of dan-petty/infra. Here the scope is the product manifests of k8s/devops/ only. A skip list for environment kinds is not needed. Consider the infra workflow before new code.
Problem Description
No CI job validates a Kubernetes manifest against a schema. A schema error in a manifest, such as a wrong field of a PodMonitor or a CloudNativePG Cluster, can merge. The evidence of pull request #5048 said that CI runs kubeconform for the new PodMonitor, and the evidence of #5030 said that kubeconform did not run. Their reviews ran kubeconform by hand.
- The Security Scan step of
.github/workflows/ci.ymlrunsdevops scan report. CI does not install kubeconform, so the scan skips it with a warning and does not fail. - No file of
.github/workflows/names kubeconform (git grep -n -i kubeconform -- .github/finds only.github/labels.yml). - The
k8srow ofdevops ci(tests/gate/k8s.py,tests/gate/k8s_checks/) renders the kustomizations and checks named fields. It validates no schema.
Reproduction Steps
- Open the log of a
Static Analysisjob onmain, for example job 131206020361 of run 43225066588 (2026-11-12). - Search the log for
kubeconform. - Run
kubeconform -strict -summary k8s/llm/gateway-db.yamlwith kubeconform 0.8.0.
Expected vs Actual Behavior
Expected: CI validates each rendered manifest, custom resources included, and a schema error fails a required check.
Actual:
- Log line 876 of the job:
! Scanner 'kubeconform' was not run (Binary 'kubeconform' not found on PATH).The job passes. - Without a schema location for custom resources, kubeconform 0.8.0 gives
could not find schema for PodMonitorandcould not find schema for Cluster(Errors: 2). The adaptersrc/devops_cli/security/kubeconform.pypasses-strictand no-schema-location. Thus only an install would make the scan fail on each custom resource. - With
-schema-location default -schema-location 'https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/{{.Group}}/{{.ResourceKind}}_{{.ResourceAPIVersion}}.json', the same file gives Valid: 3, Errors: 0.
Proposed Fix
- Validate the kustomize renders of the committed applications with kubeconform in a required CI job, with the default schemas and a pinned CRD schema catalog.
- Install kubeconform in CI with a pinned, checksummed step or a digest-pinned image, as the
Run actionlintstep does. chore(tools): remove devops install-tools and tools.lock #4363 removesdevops install-tools, so do not add a new user of it. - Decide for each custom resource with no schema in the catalog: add the schema, or skip the kind with a reason.
Environment Diagnostics
.github/workflows/ci.yml on main, 2026-11-12. kubeconform 0.8.0 (the pin of .devcontainer/Dockerfile).
Acceptance Criteria
- A required CI check fails on a manifest with a schema error, and a test or a fixture shows it.
- The CI log shows kubeconform validating the custom resources of
k8s/, with no "was not run" line.
Source: #5048
Alternatives check of 2026-11-22: in-use.
The repository already uses this tool.
Tool: yannh/kubeconform (https://github.com/yannh/kubeconform), Apache-2.0, last activity 2026-06-13, maintained.
Reason: Searches found kubeconform, a maintained validator that checks manifests against Kubernetes OpenAPI JSON schemas in strict mode and takes extra schema locations for custom resources; the project already runs it, so the need is CI wiring and pinning.
Covers:
- Strict schema validation of Kubernetes manifests
- Configurable remote and local schema locations for CRDs
- Custom resource validation through a pinned catalog URL
- JSON, JUnit and TAP output for CI logs
Lacks:
- No install step in CI; the scan skips a missing binary
- Does not render kustomizations itself
- No guideline lint checks; kube-linter holds those
- No schema for kinds absent from the catalog, such as SeaweedFS CRs
Proposed design
Problem statement
CI does not validate the product Kubernetes manifests in k8s/devops/ against a schema. A wrong field in a product manifest can merge. The Security Scan skips kubeconform when the binary is absent. The k8s row renders the manifests but checks no schema.
Acceptance criteria
Requirement: Kubeconform validates each product render
The k8s row of devops ci SHALL validate each rendered product manifest with kubeconform in strict mode.
Scenario: A schema error fails the k8s row
- WHEN A rendered fixture manifest has a field that the kubeconform test double rejects as a schema error.
- THEN The k8s row exits non-zero and prints the kubeconform error for the fixture manifest.
Requirement: The k8s row validates the render, not the source
The k8s row SHALL pass the kustomize render output to kubeconform and SHALL NOT pass a kustomization.yaml file.
Scenario: The source kustomization is not a resource
- WHEN The k8s row validates a product kustomization that has a
kustomization.yamlfile. - THEN The kubeconform command receives the render output and no
kustomization.yamlpath.
Requirement: The runner accepts schema locations
The kubeconform runner in src/devops_cli/security/kubeconform.py SHALL accept extra -schema-location values and pass them to kubeconform.
Scenario: The runner passes the default and the pinned catalog
- WHEN The k8s row calls the runner with
-schema-location defaultand a commit-pinned catalog URL. - THEN The kubeconform command contains
-strict,-schema-location defaultand the pinned catalog URL.
Requirement: The CRD catalog is pinned
The k8s row SHALL pin the datreeio CRDs-catalog schema location to a commit SHA.
Scenario: The catalog URL is pinned
- WHEN A test calls the kubeconform command builder of the k8s row.
- THEN The catalog URL contains a 40-character commit SHA and does not use the
mainbranch.
Requirement: An unknown custom resource fails
The k8s row MUST fail on a custom resource whose schema is absent, unless k8s/kubeconform-skip.yaml names its kind and reason.
Scenario: An unlisted kind fails
- WHEN A rendered fixture has a custom resource kind that the catalog and skip file do not name.
- THEN The k8s row exits non-zero and prints the missing schema for that kind.
Requirement: A listed kind passes with its reason
The k8s row SHALL skip a missing schema only for a kind that k8s/kubeconform-skip.yaml names with a non-empty reason.
Scenario: A listed kind passes
- WHEN A rendered fixture has a custom resource kind that the skip file names with a reason.
- THEN The k8s row passes and prints the recorded reason for the skipped kind.
Requirement: The static job installs kubeconform
The Static Analysis job MUST put kubeconform 0.8.0 on PATH from the pinned devtools image and MUST NOT call devops install-tools.
Scenario: The static job installs kubeconform
- WHEN The
Static Analysisjob runs on a pull request. - THEN The job log shows the
devtools-commandsstep copiedkubeconformand the k8s row finds it on PATH.
Requirement: The static job runs the k8s validation
The kubeconform validation SHALL run inside the Static Analysis job that the repository ruleset requires.
Scenario: The static job runs the k8s row
- WHEN The
Static Analysisjob runsuv run devops ci --check --no-cache --skip test,outdated,actionlint. - THEN The k8s row runs kubeconform and the job fails on a schema error.
Requirement: The Security Scan skips kubeconform
The Security Scan step of the Static Analysis job SHALL skip the kubeconform scanner because the k8s row validates the rendered manifests.
Scenario: The Security Scan skips kubeconform
- WHEN The
Static Analysisjob runsuv run devops scan report --sarif .data/scan.sarif --skip bandit,trivy,kubelinter,kubeconform. - THEN The scan passes and its log has no
Scanner 'kubeconform'line.
Requirement: A missing kubeconform fails the k8s row
The k8s row MUST fail when kubeconform is not on PATH.
Scenario: Missing binary
- WHEN The k8s row runs with no
kubeconformon PATH. - THEN The row exits non-zero and prints that kubeconform is required.
Existing Tool Considered
The alternatives block in the issue body records the verdict in-use for yannh/kubeconform. The block lists what the tool covers and lacks. This change adds the missing CI install. It feeds the kustomize render to the tool with a commit-pinned datreeio/CRDs-catalog schema location. It adds a reasoned skip only for a product custom resource that the catalog lacks. The Security Scan skips kubeconform because the k8s row owns schema validation.
Key questions
- Which manifests does this issue validate?: The product manifests of
k8s/devops/only. The environment tree, such ask8s/llm/gateway-db.yaml, lives in dan-petty/homelab and is out of scope. [sources: CONTEXT.md, .github/workflows/ci.yml] - Which inputs does the schema validation check?: The kustomize renders of the product base
k8s/devops/. The k8s row writes the renders once and passes them to kubeconform. It does not pass the source directory. (best practice) [sources: tests/gate/k8s.py, .github/workflows/ci.yml]- Rejected: Raw YAML files under
k8s/devops/. It misses generated manifests and duplicates the render logic. - Chosen: Kustomize renders. It reuses the existing render and catches generated manifests.
- Rejected:
kubectl apply --dry-run=server. It needs a live cluster and cannot run in the static job.
- Rejected: Raw YAML files under
- Which required CI check carries the schema validation?: The existing
Static Analysisjob, through the k8s row ofdevops ci. (best practice) [sources: .github/workflows/ci.yml, docs/adr/0004-ci-is-the-authoritative-gate.md, tests/gate/k8s.py]- Rejected: A new required job. It needs a ruleset change and a second render.
- Chosen: The
Static Analysisjob. The ruleset already requires it and it runs the k8s row.
- How does CI install kubeconform?: Add
kubeconformto thecommandslist of the existingdevtools-commandsstep in thestaticjob. The devtools image pins kubeconform 0.8.0. Do not add adevops install-toolsuser. (best practice) [sources: .github/workflows/ci.yml, src/devops_cli/security/kubeconform.py]- Chosen: Copy from the devtools image. It uses the existing pinned image and PATH step.
- Rejected: Download the release with a checksum. It adds a new supply-chain step and a checksum to keep.
- Rejected: Run a digest-pinned
docker://action. It cannot put the binary on PATH for the k8s row. - Rejected:
devops install-tools. chore(tools): remove devops install-tools and tools.lock #4363 removes it and the body forbids a new user.
- Which schema locations does kubeconform use?:
-schema-location defaultplus a commit-pinned datreeio/CRDs-catalog URL for custom resources. (best practice) [sources: src/devops_cli/security/kubeconform.py]- Rejected: Default schemas only. Custom resources have no default schema.
- Chosen: Default plus the pinned CRD catalog. It validates custom resources with a fixed schema source.
- Rejected: Vendor every CRD schema. It adds a maintenance burden that the catalog avoids.
- What does the k8s row do for a custom resource with no schema?: It fails unless
k8s/kubeconform-skip.yamlnames the kind and a non-empty reason. Add an entry only for a product custom resource that the pinned catalog lacks. The environment kinds are out of scope. (best practice) [sources: src/devops_cli/security/kubeconform.py, tests/gate/k8s.py, CONTEXT.md]- Chosen: Fail with a reasoned skip file. It keeps the check strict and records each exception.
- Rejected: Skip the kind silently. It hides a schema error.
- Rejected: Write a local schema for every kind. It adds a large maintenance cost for kinds that the catalog does not cover.
- Rejected: Pass
-ignore-missing-schemas. It skips every unknown kind with no reason.
- What does the Security Scan do with kubeconform?: The Security Scan skips the kubeconform scanner. The k8s row validates the rendered manifests. The scan adapter has no schema location and would fail on custom resources. (best practice) [sources: .github/workflows/ci.yml, src/devops_cli/security/kubeconform.py, src/devops_cli/security/registry.py]
- Chosen: Skip kubeconform in the Security Scan. The k8s row owns schema validation and the scan adapter has no schema location.
- Rejected: Give the scan the pinned catalog. It scans raw files and duplicates the render.
- Rejected: Leave the scan as it is. The binary on PATH makes the scan fail on custom resources.
- Does the k8s row reuse the kubeconform runner?: Yes. Extend
src/devops_cli/security/kubeconform.pyto accept extra schema locations. The k8s row uses the runner and applies the skip file to missing-schema errors. (best practice) [sources: src/devops_cli/security/kubeconform.py, tests/security/test_security_kubeconform.py, tests/gate/k8s.py]- Chosen: Extend the existing runner. It keeps one strict-mode invocation path and its tests.
- Rejected: Add a new runner. It duplicates the existing adapter.
- Does this issue include the kube-linter checks?: No. The kube-linter row of ci(k8s): Run kube-linter on the rendered manifests in CI #6068 takes the guideline checks. This issue keeps kubeconform only. (best practice) [sources: src/devops_cli/security/kubelinter.py, tests/gate/k8s.py, .github/workflows/ci.yml]
- Chosen: Keep kubeconform only. The kube-linter row of ci(k8s): Run kube-linter on the rendered manifests in CI #6068 delivers the guideline checks.
- Rejected: Add kube-linter here. It duplicates the work of ci(k8s): Run kube-linter on the rendered manifests in CI #6068.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 12, 2026
Both add a CI check over k8s/ manifests, but #2093 rejects :latest image tags while this candidate validates manifests against a schema with kubeconform.dan-petty commentedon Nov 13, 2026
Scope from the spec split (2026-11-13)
Also run kube-linter in the same CI job, on the same full render as kubeconform. Give it a committed
.kube-linter.yamlthat turns on the checks thatdocs/guidelines/kubernetes.mdnames (the amendment of PR #5492), such asunset-memory-requirements,unset-cpu-requirements,no-liveness-probeandno-readiness-probe.Reason: the owner directions of 2026-11-13 remove the hand counts from the specs. Two drafts counted the containers with no memory limit as 13 of 52 and as 25 of 115, with different scopes. One kube-linter run on the full render gives one count at each CI run, and the guideline names the check id in place of a number.
src/devops_cli/security/kubelinter.pyalready runs kube-linter for the review, so reuse its runner and its report model.devops-cli-service commentedon Nov 15, 2026
Alternatives check: in-use
Reason: kubeconform is the maintained, open tool that validates rendered Kubernetes YAML against JSON schemas, and the issue's own evidence shows that with
-schema-location defaultplus the datreeio CRDs-catalog it validates the PodMonitor and CloudNativePGClusterofk8s/llm/gateway-db.yamlwith 0 errors, so it covers the schema-validation need in full; it only has to be installed in CI. The project already ships a kubeconform scanner (src/devops_cli/security/kubeconform.py, pinned in.devcontainer/Dockerfile), so the tool is already in use and only the CI wiring is missing.The repository already uses this tool.
Tool: yannh/kubeconform (https://github.com/yannh/kubeconform)
Covers:
-strictand returns a non-zero exit code on a schema error-schema-locationentries, so a pinned CRD catalog (datreeio CRDs-catalog) validates custom resources such as PodMonitor and CloudNativePG ClusterLacks:
devops cik8s must feed it the manifestsTools considered:
Searches run:
Sources:
Checked on 2026-11-15. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 17, 2026
Status set to Ready at 19bfec3 (see proposed design in issue body).
dan-petty commentedon Nov 17, 2026
Pull request #6112 (for #6068) takes the kube-linter part of the scope comment of 2026-11-13. The
kube-linterrow ofdevops cilints the build of each path source of the Argo CD Applications with.kube-linter.yaml. This item keeps kubeconform.write_path_rendersofsrc/devops_cli/k8s/app_render.pywrites the builds to one folder, so kubeconform can read the same builds. The Helm chart sources are #6106.dan-petty commentedon Nov 19, 2026
Evidence from #6439 (2026-11-19).
uv run devops k8s validate k8s/llm/gatewaygives two HIGH findings, on origin/main (fda0478) and on the #6439 branch alike:kustomization.yaml: Kubeconform statusError, "Kustomization '' could not be validated". The command validates the files of the directory, not the kustomize render, so it readskustomization.yamlas a resource.servicemonitor.yaml: Kubeconform statusError, "ServiceMonitor 'llm-gateway' could not be validated". No schema location gives themonitoring.coreos.comCRD.The design of this issue (validate the kustomize render, with a pinned CRD catalog) removes both. #6439 does not change them.
dan-petty commentedon Nov 22, 2026
More evidence from #4756 (PR #6724):
uv run devops k8s validate k8s/object-storereportsKubeconform statusError ... could not be validatedfor each SeaweedFS operator CR (Seaweedonmain, and the 18 newBucket,BucketLifecyclePolicy,S3Identity,S3Policy,S3PolicyBinding,S3CredentialsandResourceReferenceGrantCRs), because kubeconform has no schema for their kinds. On 2026-11-22 the 18 CRs passedkubectl apply --dry-run=serveragainst the live CRDs of chart 0.1.48, but no CI job checks them.devops-cli-service commentedon Nov 26, 2026
Next step: the stage job writes the plan of the item. See the section Proposed design of the body.