Skip to content

chore(charts): add values.schema.json for Helm input validation - #1261

Closed
ferponse wants to merge 1 commit into
opensandbox-group:mainfrom
ferponse:chore/add-values-schema
Closed

chore(charts): add values.schema.json for Helm input validation#1261
ferponse wants to merge 1 commit into
opensandbox-group:mainfrom
ferponse:chore/add-values-schema

Conversation

@ferponse

@ferponse ferponse commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

The charts have no values.schema.json, so helm install does not validate user-provided values. Invalid or mistyped values (wrong types, unexpected keys) are silently ignored until the chart fails to render or the pod fails to start.

Closes #1255

Changes

  • Adds values.schema.json to opensandbox-controller, opensandbox-server and opensandbox charts, generated from their respective values.yaml using the helm-schema plugin
  • Adds .github/workflows/helm-schema.yml — triggers on PRs that touch values.yaml, regenerates the schema and auto-commits it

How it works

The JSON Schema is derived directly from values.yaml. Helm validates user-provided --set flags and -f values.yaml overrides against it at install/upgrade time. Examples of what gets caught:

# Type mismatch — caught at install time instead of runtime
helm install opensandbox-controller . --set controller.replicaCount=abc
# Error: values don't meet the specifications of the schema(s) in the following chart(s):
#   opensandbox-controller: controller.replicaCount: Invalid type. Expected: integer, given: string

# Unknown key typo — caught immediately
helm install opensandbox-controller . --set controller.replicaCont=2
# Error: additional properties 'replicaCont' not allowed

Verified locally

# All schemas are valid JSON
python3 -c "import json; json.load(open('values.schema.json'))"  # ✓ each chart

# helm lint passes with schemas present
helm lint kubernetes/charts/opensandbox-controller  # 1 chart(s) linted, 0 chart(s) failed
helm lint kubernetes/charts/opensandbox-server      # 1 chart(s) linted, 0 chart(s) failed

Notes

  • No breaking change — users who don't pass invalid values are unaffected.
  • Consistent with Helm best practices for production charts.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b12d05aa6c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +5 to +7
"global": {
"type": "null"
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Allow global values in the umbrella schema

Helm validates the final .Values object against values.schema.json on install/upgrade/template (https://helm.sh/docs/topics/charts/#schema-files), so an all-in-one install with global: {} or the global.imagePullSecrets block advertised in kubernetes/charts/opensandbox/values.yaml now fails validation because this property only permits null. Please model global as an object with additional properties so standard parent-chart global values remain accepted.

Useful? React with 👍 / 👎.

Comment on lines +53 to +55
"qps": {
"type": "integer"
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Allow fractional kube-client QPS values

The controller's --kube-client-qps flag is registered with flag.Float64Var (kubernetes/cmd/controller/main.go:197) and the template emits the raw value when positive, so a custom values file with controller.kubeClient.qps: 12.5 was valid before this schema. With Helm schema validation on the final values (https://helm.sh/docs/topics/charts/#schema-files), Helm now rejects that supported fractional QPS; use JSON Schema number for qps.

Useful? React with 👍 / 👎.

@ferponse

ferponse commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

Closing — auto-generated schemas produce incorrect types for edge cases (e.g. global: null instead of object, qps: integer instead of number). A hand-crafted schema would be more reliable but is out of scope for this PR. The chart-testing CI (#1260) already catches many issues without requiring a schema file.

@ferponse ferponse closed this Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/k8s For kubernetes runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore(charts): add values.schema.json to validate chart inputs

1 participant