Skip to content

feat(helm): add values schema and chart-testing lint (#381 M2, M3)#408

Draft
WentingWu666666 wants to merge 1 commit into
documentdb:mainfrom
WentingWu666666:developer/wentingwu/helm-schema-and-ct-lint
Draft

feat(helm): add values schema and chart-testing lint (#381 M2, M3)#408
WentingWu666666 wants to merge 1 commit into
documentdb:mainfrom
WentingWu666666:developer/wentingwu/helm-schema-and-ct-lint

Conversation

@WentingWu666666

Copy link
Copy Markdown
Collaborator

Part of the GA-readiness chart audit (#381) — items M2 and M3.

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.json

Adds a draft-07 JSON Schema for values.yaml. Helm automatically validates user-supplied values against it on install / upgrade / template / lint, so mistakes fail fast with an actionable message instead of becoming runtime errors. Examples now rejected up front:

  • --set replicaCount=onegot string, want integer
  • --set image.documentdbk8soperator.pullPolicy=Sometimesvalue must be one of 'Always', 'IfNotPresent', 'Never'
  • --set replicaCont=2 (typo) → additional properties 'replicaCont' not allowed

The 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 bundled cloudnative-pg subchart values.

M3 — chart-testing lint in CI

Adds a Helm Chart Lint (chart-testing) job to test-unit.yml using the standard helm/chart-testing action — the same tool CNPG uses in its lint.yml. ct lint runs helm 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 combinations ct lint renders 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.yaml passes for values.yaml and all three ci/*-values.yaml files.
  • Schema rejects bad types, invalid enums, and unknown keys (verified via helm template --set).
  • helm lint clean; helm unittest — 82 tests pass.

Notes

Tracking

…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>
Copilot AI review requested due to automatic review settings June 23, 2026 17:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 validate values.yaml and 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.yaml render 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.

@WentingWu666666 WentingWu666666 marked this pull request as draft June 23, 2026 17:24
@documentdb-triage-tool

Copy link
Copy Markdown

🤖 Auto-triaged by documentdb-triage-tool.

Applied: CI/CD, enhancement
Project fields suggested: Component ci · Priority P2 · Effort L · Status In Progress
Confidence: 0.82 (mixed)

Reasoning

component 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 @patty-chow so the rules can be tuned. The bot will not re-label items that already have component labels.

@documentdb-triage-tool documentdb-triage-tool Bot added the enhancement New feature or request label Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI/CD enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants