fix: enable --skip-schema-validation on any Helm that supports it#22
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Customers running the setup script hit a hard failure during
opentelemetry-operatorinstall:The upstream chart's
values.schema.jsondeclaresmanager.featureGates.examplesas 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 onhelm 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:
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_FLAGalready 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 implicitset -e).Verification
helm template ... --skip-schema-validationhelm template ...without the flagexamples: got string, want arrayerrorbats tests/unit.bats