Skip to content

chore(chart): add values.schema.json to catch typo'd/unknown top-level keys - #507

Open
VanshikaR7 wants to merge 2 commits into
mainfrom
claude/values-schema-validation
Open

chore(chart): add values.schema.json to catch typo'd/unknown top-level keys#507
VanshikaR7 wants to merge 2 commits into
mainfrom
claude/values-schema-validation

Conversation

@VanshikaR7

Copy link
Copy Markdown

Summary

A customer values.yaml (nudgebee-on-prem-test) set a top-level existingPrometheus.url key that doesn't exist anywhere in this chart, so it silently no-oped instead of wiring up OpenCost's Prometheus endpoint. PROMETHEUS_SERVER_ENDPOINT stayed empty and the OpenCost pod crash-looped for days before the misconfiguration was traced back to that key.

This adds charts/nudgebee-agent/values.schema.json — Helm's native JSON-Schema values validation. It whitelists the chart's real top-level keys and sets additionalProperties: false, so helm install/helm upgrade now fails fast and locally with a clear error for any unrecognized top-level key, instead of silently ignoring it.

Nested subchart-owned trees (opencost, opentelemetry-collector, clickhouse, etc.) are left permissive (type: object only) since those are third-party chart values we don't want to have to keep re-syncing as upstream changes.

.github/configs/ct.yaml already has validate-chart-schema: true, so the existing helm-dev-lint.yml / helm-prod-test.yml CI workflows pick this up automatically — no workflow changes needed.

Type of change

  • Bug fix (non-breaking)
  • New feature (non-breaking)
  • Breaking change (chart upgrade requires user action)
  • Documentation only
  • CI / tooling

Note: this is non-breaking for any values.yaml that only uses documented keys. It will start rejecting values files that contain an unrecognized top-level key on their next upgrade to a chart version including this schema — surfacing a pre-existing misconfiguration rather than changing any rendered output.

Chart version

  • No version bump needed (version/appVersion in Chart.yaml are set automatically by .github/workflows/release.yaml, per the comment at the top of that file)

Test plan

  • Verified schema semantics with a local JSON-Schema validation pass (Python jsonschema, draft-07) since a Helm binary wasn't available in this environment:
    • Default charts/nudgebee-agent/values.yaml validates cleanly against the new schema.
    • Adding the exact existingPrometheus.url key from the incident is correctly rejected: Additional properties are not allowed ('existingPrometheus' was unexpected).
  • helm lint charts/nudgebee-agent / ct lint (should be exercised by CI on this PR)
  • helm template output reviewed — unaffected, this change adds no templates

Related issues

Follow-up from the nudgebee-on-prem-test OpenCost disconnection investigation (Slack thread, not a tracked GitHub issue).


Generated by Claude Code

…l keys

Root-cause of the nudgebee-on-prem-test OpenCost outage: a customer
values.yaml set a top-level 'existingPrometheus.url' key that doesn't
exist anywhere in this chart, so it silently no-oped instead of wiring
up OpenCost's Prometheus endpoint. Helm has no way to flag unknown keys
without a values.schema.json, so the typo only surfaced later as a
CrashLoopBackOff.

This schema enforces additionalProperties: false at the top level, so
'helm install/upgrade' now fails fast locally with a clear error for
any unrecognized top-level key. Nested subchart-owned trees (opencost,
opentelemetry-collector, clickhouse, etc.) are left permissive to avoid
having to keep a full schema in sync with upstream chart changes.

ct.yaml already has validate-chart-schema: true, so CI picks this up
automatically via the existing helm-dev-lint/helm-prod-test workflows.
@VanshikaR7
VanshikaR7 requested a review from a team as a code owner July 4, 2026 12:59

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a JSON schema (values.schema.json) for the nudgebee-agent Helm chart to validate top-level configuration values. The reviewer pointed out that because additionalProperties is set to false, the schema will reject the standard Helm global key, which is commonly used to pass values to subcharts. They suggested adding global to the allowed properties to prevent validation failures.

Comment on lines +21 to +22
"clickhouse": { "type": "object" },
"alertmanager": { "type": "object" }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Since additionalProperties: false is set, any top-level keys not explicitly defined in this schema will cause validation to fail. Helm reserves the global key for passing values to all charts (including subcharts like clickhouse or opentelemetry-collector, which often rely on global for shared settings like image registries or pull secrets).

To prevent validation failures when users specify global values, please add the global key to the schema properties.

    "clickhouse": { "type": "object" },
    "alertmanager": { "type": "object" },
    "global": { "type": "object" }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants