feat(helm): add values schema and chart-testing lint (#381 M2, M3)#408
Conversation
…M2, M3) Address GA chart-audit items M2 and M3, aligning with upstream CloudNative-PG chart practice. M2 — values.schema.json: - Add a draft-07 JSON Schema for values.yaml. Helm validates user-supplied values at install/upgrade/template/lint time, turning typos and wrong types into actionable errors instead of runtime failures (e.g. a string replicaCount, an invalid pullPolicy enum, or an unknown top-level key are now rejected up front). M3 — chart-testing lint in CI: - Add a 'Helm Chart Lint (chart-testing)' job to test-unit.yml using the standard helm/chart-testing action (ct lint), matching CNPG's lint.yml. ct lint runs helm lint, validates values against the schema, and lints chart YAML. - Add .github/configs/ct.yaml (chart-testing config) and a lenient .github/configs/lintconf.yaml (yamllint). - Add operator/documentdb-helm-chart/ci/*-values.yaml so ct lint renders and schema-validates the chart under multiple value combinations: baseline, walReplica=true, and a custom-namespace + imagePullSecrets + scheduling overrides case. Verified locally: ct lint passes for values.yaml and all three ci value files; the schema rejects bad types/enums/unknown keys; helm unittest (82 tests) still passes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Wenting Wu <wentingwu@microsoft.com>
There was a problem hiding this comment.
Pull request overview
Adds Helm chart values validation and CI linting for the DocumentDB operator Helm chart to catch misconfigurations early and align with upstream CloudNative-PG chart practices.
Changes:
- Introduces
values.schema.json(draft-07) to validatevalues.yamland user overrides at install/upgrade/template/lint time. - Adds chart-testing (
ct lint) as a GitHub Actions job to lint and schema-validate the chart under multiple value combinations. - Adds chart-testing configuration + yamllint configuration and three
ci/*-values.yamlrender cases.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| operator/documentdb-helm-chart/values.schema.json | Adds a strict top-level JSON Schema for Helm values with lenient Kubernetes-native nested structures and passthrough CNPG subchart values. |
| operator/documentdb-helm-chart/ci/default-values.yaml | Baseline values file for ct lint rendering/schema validation. |
| operator/documentdb-helm-chart/ci/walreplica-values.yaml | Values variant to exercise the WAL replica render path in ct lint. |
| operator/documentdb-helm-chart/ci/custom-namespace-values.yaml | Values variant to exercise namespace override, imagePullSecrets, and scheduling overrides in ct lint. |
| .github/workflows/test-unit.yml | Adds a “Helm Chart Lint (chart-testing)” CI job running ct lint with repo configs. |
| .github/configs/ct.yaml | Configures chart-testing to lint the operator chart deterministically with CNPG repo wiring and yamllint settings. |
| .github/configs/lintconf.yaml | Provides a deliberately lenient yamllint config for chart-testing focused on structural correctness. |
|
🤖 Auto-triaged by documentdb-triage-tool. Applied: Reasoningcomponent from path globs (ci); effort from diff stats (306+0 LOC, 7 files); LLM: Adds Helm values JSON Schema validation (M2) and chart-testing lint CI job (M3) across multiple files — CI workflow, chart configs, and schema — as part of a GA-readiness audit milestone. If a label is wrong, remove it manually and ping |
What this PR does
Adds Helm values validation and chart-testing lint to the operator chart, aligning with upstream CloudNative-PG chart practice.
M2 —
values.schema.jsonAdds a draft-07 JSON Schema for
values.yaml. Helm automatically validates user-supplied values against it oninstall/upgrade/template/lint, so mistakes fail fast with an actionable message instead of becoming runtime errors. Examples now rejected up front:--set replicaCount=one→got string, want integer--set image.documentdbk8soperator.pullPolicy=Sometimes→value must be one of 'Always', 'IfNotPresent', 'Never'--set replicaCont=2(typo) →additional properties 'replicaCont' not allowedThe schema is strict at the root (typed keys, no unknown top-level properties) and lenient for Kubernetes-native nested structures (
resources, security contexts,affinity) and the bundledcloudnative-pgsubchart values.M3 — chart-testing lint in CI
Adds a Helm Chart Lint (chart-testing) job to
test-unit.ymlusing the standardhelm/chart-testingaction — the same tool CNPG uses in itslint.yml.ct lintrunshelm lint, validates values against the schema (M2), and lints chart YAML/Chart.yaml..github/configs/ct.yaml— chart-testing config (explicit chart path, CNPG dependency repo, maintainer/version checks disabled)..github/configs/lintconf.yaml— lenient yamllint config (structural checks only).operator/documentdb-helm-chart/ci/*-values.yaml— value combinationsct lintrenders and schema-validates: baseline,walReplica=true, and a custom-namespace +imagePullSecrets+ scheduling-overrides case.Why split from #384
Kept separate from the plugin-probes PR (#384) so each change reviews independently; M2's generated schema is a large additive file that would otherwise bury the probe change.
Local verification
ct lint --config .github/configs/ct.yamlpasses forvalues.yamland all threeci/*-values.yamlfiles.helm template --set).helm lintclean;helm unittest— 82 tests pass.Notes
values.yamluses CRLF line endings; normalizing that is out of scope, so thenew-linesyamllint rule is disabled rather than reformatting the file in this PR.mainand is independent of feat(helm): add readiness probes for plugin sidecars #384.Tracking