Skip to content

feat(chart): add values.schema.json for Helm values validation - #2553

Closed
Rickydama3 wants to merge 1 commit into
Project-HAMi:masterfrom
Rickydama3:feature/helm-values-schema
Closed

feat(chart): add values.schema.json for Helm values validation#2553
Rickydama3 wants to merge 1 commit into
Project-HAMi:masterfrom
Rickydama3:feature/helm-values-schema

Conversation

@Rickydama3

@Rickydama3 Rickydama3 commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind feature

What this PR does / why we need it:
Adds charts/hami/values.schema.json — a JSON Schema (draft-07) that Helm 3.x automatically validates the coalesced chart values against during helm lint, helm template, and helm install/upgrade. Today the chart ships no schema, so type errors in user-supplied values (a quoted integer, a bool where a string is expected, a non-null value on a null-guarded field) surface only as a broken render or a malformed generated config at install time.

Which issue(s) this PR fixes:
Fixes #2419

Special notes for your reviewer:

Design

The schema is deliberately permissive. It constrains only load-bearing types, each traced to how the templates actually consume the value:

  • String-typed booleans (scheduler.overwriteEnv, metaxsGPUTopologyAware, devicePlugin.disablecorelimit) — rendered as raw YAML scalars / CLI flags, so typed string, not boolean.
  • Null-unionsnvidiaHookPath / nvidiaDriverRoot["null","string"]; gdrcopyEnabled / gdsEnabled / mofedEnabled["null","boolean"], matching the typeIs guards in daemonsetnvidia.yaml.
  • Strict integersdeviceSplitCount, preConfiguredDeviceMemory, scheduler.replicas, ports — quoted strings are correctly rejected.
  • Float scaling factorsdeviceMemoryScaling / deviceCoreScaling accept a number or a numeric string (^[0-9]+(\.[0-9]+)?$). They are Go *float64, so fractional values are first-class; the string branch preserves --set devicePlugin.deviceMemoryScaling=1.5 (Helm renders --set floats as strings) while still rejecting non-numeric input.
  • Open policy stringsnodeSchedulerPolicy / gpuSchedulerPolicy are not enum-constrained (topology-aware is valid).
  • devices.amd / devices.awsneuron carry no enabled key (their customresources are ranged unconditionally); other vendors keep enabled.

No additionalProperties: false and an empty top-level required, so undocumented and forward-compatible keys and every documented install path keep working.

Testing

Validated with the CI-pinned Helm v3.7.1:

  • helm lint charts/hami → 0 failures; helm template renders all manifests.
  • Positive: fractional --set scaling (1.5/0.8/2), genuine floats via a values file, and every --set override used by hack/deploy-helm.sh (empty registries, leaderElect=false) all pass.
  • Negative: non-numeric scaling, quoted integer fields (deviceSplitCount, replicas) all correctly rejected.

No Go files changed; build/lint/test are unaffected.

Does this PR introduce a user-facing change?:

Add values.schema.json for Helm install-time values validation

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

* **Documentation**
  * Added comprehensive validation for Helm configuration values.
  * Documented supported topology, scheduler, admission webhook, service, device-plugin, scaling, integration, and device settings.
  * Clarified accepted numeric and numeric-string scaling values, optional integration settings, and boolean enablement options.
  * Invalid or unsupported configuration values can now be identified earlier during deployment.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

@hami-robot
hami-robot Bot requested review from FouoF and wawa0210 August 10, 2026 19:53
@hami-robot hami-robot Bot added the size/L label Aug 10, 2026
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a Draft-07 JSON Schema for the HAMi Helm chart. The schema validates chart settings, scheduler and admission configuration, device plugin values, ports, optional integrations, and supported device enablement flags.

Changes

Helm values validation

Layer / File(s) Summary
Define Helm values validation
charts/hami/values.schema.json
Adds validation for topology, scheduler and admission settings, replica counts, service ports, device-plugin options, nullable integrations, scaling values, and supported device enablement flags.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: wawa0210, fouof

Poem

A rabbit checks each value with care,
Types and ports are neatly there.
Scheduler flags now align,
Device settings pass the line.
Hop, hop—valid charts are fine!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the addition of Helm values schema validation.
Linked Issues check ✅ Passed The PR adds the requested permissive Draft-07 Helm values schema and addresses the validation requirements in [#2419].
Out of Scope Changes check ✅ Passed The changes are limited to the requested charts/hami/values.schema.json addition and contain no unrelated scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@charts/hami/values.schema.json`:
- Around line 41-47: Update the deviceMemoryScaling and deviceCoreScaling
definitions to use oneOf: numeric values must be numbers with a minimum of 0,
while string values must retain the existing non-negative decimal pattern.
Remove the shared type/pattern structure so numeric -1 cannot pass validation.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a8a86c5a-ae44-49d3-8cdb-33510741cf9e

📥 Commits

Reviewing files that changed from the base of the PR and between 91f0248 and c58a383.

📒 Files selected for processing (1)
  • charts/hami/values.schema.json

Comment thread charts/hami/values.schema.json Outdated
@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
unittests 62.31% <ø> (-1.91%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 36 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@charts/hami/values.schema.json`:
- Around line 20-32: Update values.schema.json so
admissionWebhook.customURL.port is defined at the top-level path consumed by
values.yaml, rather than only under scheduler.admissionWebhook. Add the existing
service port definitions under scheduler.service to match
templates/scheduler/service.yaml, while retaining devicePlugin.service
validation for its own consumers.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2319c834-a713-4670-b4ed-8f77a52d3752

📥 Commits

Reviewing files that changed from the base of the PR and between c58a383 and cb51eee.

📒 Files selected for processing (1)
  • charts/hami/values.schema.json

Comment thread charts/hami/values.schema.json

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@charts/hami/values.schema.json`:
- Around line 5-7: Update the schemas for metaxsGPUTopologyAware and the other
corresponding string-typed boolean fields to restrict values with an enum
containing only the chart-supported boolean text values, true and false.
Preserve their string type while rejecting values such as enabled and 0.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 16d6ad8b-075f-4e4e-9ac6-327d09813bea

📥 Commits

Reviewing files that changed from the base of the PR and between cb51eee and 255400b.

📒 Files selected for processing (1)
  • charts/hami/values.schema.json

Comment thread charts/hami/values.schema.json
@Rickydama3
Rickydama3 force-pushed the feature/helm-values-schema branch from 255400b to cfac946 Compare August 10, 2026 20:43

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@charts/hami/values.schema.json`:
- Around line 38-52: Update the scheduler Service port properties httpPort,
schedulerPort, monitorPort, monitorTargetPort, and httpTargetPort in the schema
to enforce valid port numbers by adding minimum 1 and maximum 65535 constraints
to each integer definition.
- Around line 14-55: Update charts/hami/values.schema.json at lines 14-55 and
57-113: add boolean type definitions for
scheduler.forceOverwriteDefaultScheduler, scheduler.livenessProbe,
scheduler.leaderElect, scheduler.kubeScheduler.enabled, devicePlugin.enabled,
devicePlugin.hostPID, devicePlugin.hostNetwork, and
devicePlugin.gpuOperatorToolkitReady.enabled. Preserve the existing schema
structure and unknown-key behavior while ensuring these documented fields reject
string values.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fa01367e-e48c-4d15-ad78-315ad2c3c995

📥 Commits

Reviewing files that changed from the base of the PR and between 255400b and cfac946.

📒 Files selected for processing (1)
  • charts/hami/values.schema.json

Comment thread charts/hami/values.schema.json
Comment thread charts/hami/values.schema.json
@Rickydama3
Rickydama3 force-pushed the feature/helm-values-schema branch from cfac946 to 56415bd Compare August 10, 2026 20:50

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@charts/hami/values.schema.json`:
- Around line 36-38: Update the replicas schema definition to enforce a minimum
value of 0, rejecting negative replica counts while preserving zero as valid.
Modify the integer constraint within the replicas property only.
- Around line 14-35: Add schemas in charts/hami/values.schema.json for
scheduler.defaultSchedulerPolicy.nodeSchedulerPolicy,
scheduler.defaultSchedulerPolicy.gpuSchedulerPolicy, and
scheduler.metricsBindAddress as strings, and scheduler.admissionWebhook.enabled
as a boolean; update both the scheduler properties at lines 14-35 and the
related scheduler section at lines 39-50 as needed, ensuring string values such
as "false" are not used for boolean Helm conditionals.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b26ff705-94ad-409e-ba13-9d47615910df

📥 Commits

Reviewing files that changed from the base of the PR and between cfac946 and 56415bd.

📒 Files selected for processing (1)
  • charts/hami/values.schema.json

Comment thread charts/hami/values.schema.json
Comment thread charts/hami/values.schema.json
@hami-robot

hami-robot Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: leodon33
Once this PR has been reviewed and has the lgtm label, please assign fouof for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@mesutoezdil

Copy link
Copy Markdown
Contributor

This is being closed because it does not comply with the contribution guidelines.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add values.schema.json to the Helm chart for install-time values validation

2 participants