Skip to content

fix: enable --skip-schema-validation on any Helm that supports it#22

Merged
prathamesh-sonpatki merged 1 commit into
mainfrom
fix/helm-skip-schema-validation-probe
Jun 1, 2026
Merged

fix: enable --skip-schema-validation on any Helm that supports it#22
prathamesh-sonpatki merged 1 commit into
mainfrom
fix/helm-skip-schema-validation-probe

Conversation

@karthikeyangs9

Copy link
Copy Markdown
Contributor

Problem

Customers running the setup script hit a hard failure during opentelemetry-operator install:

Error: values don't meet the specifications of the schema(s) in the following chart(s):
"file:///values.schema.json#" is not valid against metaschema ...
  - at '/properties/manager/properties/featureGates/examples': got string, want array
[ERROR] Helm install/upgrade failed for opentelemetry-operator.

The upstream chart's values.schema.json declares manager.featureGates.examples as a string, but the JSON Schema metaschema (draft 2019-09) requires an array. Helm 3.18.5 made this metaschema validation strict (a security hardening), so installs abort before any resource is applied.

Root cause

The script already had the right workaround — --skip-schema-validation — but gated it on helm major >= 4. The strict validation lands in 3.18.5, not v4. So developers on Helm v4 saw it work, while every customer on Helm 3.18.5–3.x got no flag and failed.

Fix

Replace version-number parsing with a capability probe:

detect_helm_schema_flag() {
    if helm upgrade --help 2>/dev/null | grep -q -- '--skip-schema-validation'; then
        HELM_SCHEMA_FLAG="--skip-schema-validation"
        ...
    fi
}

The flag is now enabled on every Helm that supports it (3.16+ and v4), and the check is immune to future version-string format changes. K8s admission controllers still validate every rendered resource, so skipping client-side schema validation is safe. $HELM_SCHEMA_FLAG already flows into all install paths (operator, collector, monitoring, kube-events).

No Helm upgrade/downgrade required — customers keep their existing Helm.

Tests

3 bats regression tests in tests/unit.bats: flag enabled when supported, the Helm 3.18.5 (major 3) customer case, and old Helm leaving it empty. Assertions are the last command in each test (bats has no implicit set -e).

Verification

Run (operator chart 0.92.1, real flags) Result
helm template ... --skip-schema-validation exit 0 — full manifest renders (Deployment, 4 CRDs, webhooks, RBAC)
helm template ... without the flag reproduces the exact examples: got string, want array error
bats tests/unit.bats 22 passed, 0 failed

The setup script only added --skip-schema-validation when Helm's major
version was >= 4. The strict JSON Schema metaschema validation (draft
2019-09) that rejects the upstream opentelemetry-operator chart was
actually introduced in Helm 3.18.5, not Helm v4. The chart's
values.schema.json declares manager.featureGates.examples as a string
when the metaschema requires an array, so installs failed with:

  values.schema.json is not valid against metaschema ...
  examples: got string, want array

Developers on Helm v4 never saw this; every customer on Helm 3.18.5-3.x
hit it because the flag was never added.

Replace version-number parsing with a capability probe
(`helm upgrade --help | grep -q -- --skip-schema-validation`), so the
flag is enabled on every Helm that supports it (3.16+ and v4) and is
robust to future version-string format changes. K8s admission still
validates rendered resources, so skipping client-side schema validation
is safe.

Add bats regression tests covering: flag enabled when supported, the
Helm 3.18.5 (major 3) customer case, and old Helm leaving it empty.
Tests assert as the last command (bats has no implicit set -e, so a
trailing cleanup would mask assertion failures).

Verified offline against opentelemetry-operator chart 0.92.1: renders
cleanly with the flag, reproduces the exact error without it.
@prathamesh-sonpatki prathamesh-sonpatki merged commit c6be1b1 into main Jun 1, 2026
8 checks passed
@prathamesh-sonpatki prathamesh-sonpatki deleted the fix/helm-skip-schema-validation-probe branch June 1, 2026 06:59
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