Skip to content

fix(bundler): emit disableValidation on CRD-dependent -post wrappers - #1687

Merged
mchmarny merged 1 commit into
mainfrom
fix/post-manifest-crd-validation
Jul 9, 2026
Merged

mchmarny merged 1 commit into
mainfrom
fix/post-manifest-crd-validation

Conversation

@mchmarny

@mchmarny mchmarny commented Jul 9, 2026

Copy link
Copy Markdown
Member

Summary

Helmfile bundles now emit disableValidation: true on an injected -post wrapper release when its manifests instantiate CRs of CRDs the parent chart installs, via a new registry flag manifestsUseChartCRDs (set on network-operator). Fixes fresh-cluster helmfile apply failing with no matches for kind "NicClusterPolicy" in version "mellanox.com/v1alpha1".

Motivation / Context

The AKS overlay attaches nic-cluster-policy-aks.yaml (a NicClusterPolicy CR) as manifestFiles on network-operator; the bundler wraps it into the injected network-operator-post release. That wrapper shares the parent's sub-helmfile level, and helmfile diffs every release in a level before applying any — the needs: edge orders apply, not diff — so on a fresh cluster helm-diff's REST-mapper check runs before the parent has installed the CRDs and can never pass. The existing disableValidation mitigation (#914) is deliberately scoped to primary releases (#929), which didn't account for wrapper manifests depending on parent-shipped CRDs.

Fixes: #1666
Related: #914, #929

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

Component(s) Affected

  • Recipe engine / data (pkg/recipe)
  • Bundlers (pkg/bundler, pkg/component/*)
  • Docs/examples (docs/, examples/)

Implementation Notes

Testing

make qualify   # PASS
  • New TestBuildHelmfile_DisableValidationPostManifests pins pre/primary/post emission (written first, red on the missing field).
  • Coverage: pkg/bundler/deployer/helmfile 85.6% → 86.9% (+1.3%).
  • Live verification on a fresh AKS cluster (aicr-test1, K8s 1.35.5) that reproduced helmfile: fresh-cluster apply fails diff on -post wrappers referencing parent-shipped CRDs #1666: with the flag emitted, the previously-fatal network-operator-post diff passes, helmfile apply completes (exit 0), and the NicClusterPolicy CR is created; regenerating the bundle from the same recipe with the patched binary emits disableValidation: true on network-operator-post automatically.

Risk Assessment

  • Low — Isolated change, well-tested, easy to revert

Rollout notes: Only affects newly generated helmfile bundles for recipes whose components carry the new flag (today: network-operator with attached manifests, i.e. AKS). Existing bundles are unchanged; regenerate to pick up the fix.

Checklist

  • Tests pass locally (make test with -race)
  • Linter passes (make lint)
  • I did not skip/disable tests to make CI green
  • I added/updated tests for new functionality
  • I updated docs if user-facing behavior changed
  • Changes follow existing patterns in the codebase
  • Commits are cryptographically signed (git commit -S) — GPG signing info

@mchmarny
mchmarny requested review from a team as code owners July 9, 2026 17:50
@mchmarny mchmarny added the theme/deployer Helm, ArgoCD, and deployment bundle generation label Jul 9, 2026
@mchmarny mchmarny self-assigned this Jul 9, 2026
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

Recipe evidence check

Registry change: scoped to recipes that reference a changed component
entry in recipes/registry.yaml (not every leaf).

Other affected recipes without evidence yet: 22

These recipes are affected by this PR but carry no committed evidence pointer, so there is
nothing to verify. This is expected — evidence is hardware-gated and added over time.

  • a100-aks-training
  • a100-aks-ubuntu-training-kubeflow
  • a100-aks-ubuntu-training
  • a100-eks-ubuntu-training-kubeflow
  • a100-gke-cos-training-kubeflow
  • a100-oke-ubuntu-training-kubeflow
  • b200-gke-cos-training-kubeflow
  • gb200-eks-ubuntu-training-kubeflow
  • gb200-oke-ubuntu-training-kubeflow
  • h100-aks-inference
  • h100-aks-training
  • h100-aks-ubuntu-inference-dynamo
  • h100-aks-ubuntu-inference
  • h100-aks-ubuntu-training-kubeflow
  • h100-aks-ubuntu-training
  • h100-eks-ubuntu-training-kubeflow
  • h100-gke-cos-training-kubeflow
  • h100-kind-inference-dynamo
  • h100-kind-inference
  • h100-kind-training-kubeflow
  • h100-kind-training-slurm
  • h100-kind-training

This gate is warning-only and never blocks merge. See ADR-007 for the trust model.

@github-actions

github-actions Bot commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

Coverage Report ✅

Metric Value
Coverage 78.7%
Threshold 75%
Status Pass
Coverage Badge
![Coverage](https://img.shields.io/badge/coverage-78.7%25-green)

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/NVIDIA/aicr/pkg/bundler/deployer/helmfile 86.88% (+0.12%) 👍
github.com/NVIDIA/aicr/pkg/bundler/deployer/localformat 73.42% (+0.04%) 👍
github.com/NVIDIA/aicr/pkg/recipe 87.54% (ø)

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/NVIDIA/aicr/pkg/bundler/deployer/helmfile/helmfile.go 81.65% (ø) 158 129 29
github.com/NVIDIA/aicr/pkg/bundler/deployer/helmfile/releases.go 100.00% (ø) 63 (+2) 63 (+2) 0
github.com/NVIDIA/aicr/pkg/bundler/deployer/localformat/folder.go 75.00% (ø) 4 3 1
github.com/NVIDIA/aicr/pkg/bundler/deployer/localformat/vendor_folder.go 70.53% (ø) 95 67 28
github.com/NVIDIA/aicr/pkg/bundler/deployer/localformat/writer.go 73.73% (+0.12%) 217 (+1) 160 (+1) 57 👍
github.com/NVIDIA/aicr/pkg/recipe/components.go 86.78% (ø) 121 105 16

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

@mchmarny
mchmarny requested a review from yuanchen8911 July 9, 2026 18:28

@yuanchen8911 yuanchen8911 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Two gaps in the flag's coverage, detailed inline: the --vendor-charts layout collapses post manifests into the primary wrapper so the -post release-name condition never fires, and kubeflow-trainer has the same post-manifest/parent-CRD shape via platform-kubeflow but doesn't get the flag. The mechanism and scoping of the change itself look right (the -post-only emission, #929 preservation on primaries and -pre wrappers, and the test).

Comment thread recipes/registry.yaml Resolved
@coderabbitai

coderabbitai Bot commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a new manifestsUseChartCRDs field to ComponentConfig, enables it for selected registry entries, and documents the field in contributor docs. Local folder metadata now records whether a folder carries post manifests, and helmfile uses that marker with the new registry flag to set disableValidation for post-wrapper releases and collapsed vendored mixed layouts. Tests cover the new folder marker and the resulting helmfile behavior.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Suggested labels: area/tests

Suggested reviewers: lockwobr

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: enabling disableValidation for CRD-dependent -post wrappers.
Description check ✅ Passed The description matches the implemented fix and explains the new registry flag and -post wrapper behavior.
Linked Issues check ✅ Passed The code adds explicit support for CRD-dependent post wrappers and keeps primary and pre wrappers validated, matching #1666.
Out of Scope Changes check ✅ Passed The extra docs, tests, and vendored/multiple-component support are consistent with the stated fix and not out of scope.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/post-manifest-crd-validation

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

Injected -post wrapper releases carry manifestFiles that instantiate
CRs of CRDs the parent chart installs, but the wrapper shares the
parent's sub-helmfile level and helmfile diffs every release in a
level before applying any — so on a fresh cluster the wrapper's
helm-diff REST-mapper check can never pass (network-operator's
NicClusterPolicy on AKS, kubeflow-trainer's ClusterTrainingRuntime
via platform-kubeflow).

Add registry flag manifestsUseChartCRDs (sibling of hasSelfRefCRDs,
issue #914) that emits disableValidation: true on the release whose
folder carries the post-phase manifests. The decision is keyed off a
new localformat Folder.CarriesPostManifests marker — set by both the
-post injection writer and the collapsed vendored mixed wrapper — so
the fix also covers --vendor-charts bundles, where mixed components
never split and a release-name-suffix check would be a silent no-op.
Primaries without post manifests and -pre wrappers keep the mapper
sanity check per issue #929. Set the flag on network-operator and
kubeflow-trainer.

Fixes: #1666
Signed-off-by: Mark Chmarny <[email protected]>
@mchmarny
mchmarny force-pushed the fix/post-manifest-crd-validation branch from fbda78f to 49f5da5 Compare July 9, 2026 19:49
@github-actions github-actions Bot added size/L and removed size/M labels Jul 9, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 97625e1f-15aa-41f2-a047-95fe08aa4332

📥 Commits

Reviewing files that changed from the base of the PR and between 2358d65 and 49f5da5.

📒 Files selected for processing (12)
  • docs/contributor/component.md
  • docs/contributor/recipe.md
  • pkg/bundler/deployer/helmfile/helmfile.go
  • pkg/bundler/deployer/helmfile/helmfile_test.go
  • pkg/bundler/deployer/helmfile/releases.go
  • pkg/bundler/deployer/localformat/folder.go
  • pkg/bundler/deployer/localformat/vendor_folder.go
  • pkg/bundler/deployer/localformat/vendor_write_test.go
  • pkg/bundler/deployer/localformat/writer.go
  • pkg/bundler/deployer/localformat/writer_test.go
  • pkg/recipe/components.go
  • recipes/registry.yaml

Comment on lines +193 to +197
// Mixed components collapse into this single folder under
// VendorCharts, so the post-phase manifests live in its
// templates/ as post-install hooks (see writeMixedManifests
// above) — the marker travels with them.
CarriesPostManifests: len(manifests) > 0,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

Marker uses pre-render manifest count, not actual written templates.

CarriesPostManifests: len(manifests) > 0 is set from the raw manifest map before writeMixedManifests filters out entries that render to empty YAML (skipped at lines 279-283 of writeMixedManifests). If every manifest for a component renders empty, the folder is marked CarriesPostManifests: true even though templateRelPaths (and thus the folder's actual templates/) is empty — contradicting the field's own doc ("this folder's chart contains the component's post-phase raw manifests"). Effect is only an unnecessary disableValidation: true downstream, not a missed safety check, so this is a low-severity inconsistency.

Consider deriving the marker from templateRelPaths (computed at line 143) instead of the raw manifests map, to keep the marker's semantics aligned with what's actually written.

♻️ Proposed fix
 	templateRelPaths, err := writeMixedManifests(ctx, folderDir, dir, c, manifests)
 	if err != nil {
 		return Folder{}, VendorRecord{}, err
 	}
@@
 		CreateNamespace: true,
 		// Mixed components collapse into this single folder under
 		// VendorCharts, so the post-phase manifests live in its
 		// templates/ as post-install hooks (see writeMixedManifests
 		// above) — the marker travels with them.
-		CarriesPostManifests: len(manifests) > 0,
+		CarriesPostManifests: len(templateRelPaths) > 0,
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Mixed components collapse into this single folder under
// VendorCharts, so the post-phase manifests live in its
// templates/ as post-install hooks (see writeMixedManifests
// above) — the marker travels with them.
CarriesPostManifests: len(manifests) > 0,
// Mixed components collapse into this single folder under
// VendorCharts, so the post-phase manifests live in its
// templates/ as post-install hooks (see writeMixedManifests
// above) — the marker travels with them.
CarriesPostManifests: len(templateRelPaths) > 0,

@mchmarny
mchmarny merged commit e8450d5 into main Jul 9, 2026
228 checks passed
@mchmarny
mchmarny deleted the fix/post-manifest-crd-validation branch July 9, 2026 20:14
ArangoGutierrez added a commit to ArangoGutierrez/aicr that referenced this pull request Jul 10, 2026
Kueue was registered in the component registry but referenced by zero
overlays and shipped no queue or quota CRs, so a deployed Kueue admitted
nothing out of the box.

- Add registry-level manifestFiles defaults to ComponentConfig: a
  component can now ship default manifests wherever a recipe references
  it; ref-declared (overlay/mixin) lists take precedence. No opt-out:
  an empty ref-declared list is indistinguishable from absent — declare
  a replacement list to suppress the defaults.
- Fail closed at registry load when a Kustomize-typed component
  declares manifestFiles: validateComponentRef rejects the combination
  per-ref, so a registry-level mistake would otherwise surface at
  resolution time in every consumer at once.
- Mark kueue manifestsUseChartCRDs: the quota CRs instantiate CRDs the
  chart itself installs, so the injected kueue-post wrapper needs the
  helm-diff REST-mapper bypass (NVIDIA#914/NVIDIA#929 pattern, added in NVIDIA#1687).
- Bump kueue chart 0.17.1 -> 0.18.2 and ship default quota CRs
  (ResourceFlavor with GPU-taint toleration, ClusterQueue with
  admission-neutral quotas, LocalQueue default/default) as post-install
  hooks ordered by dependency.
- Pin managerConfig to the chart 0.18.2 default with
  integrations.frameworks trimmed to batch/job, JobSet, TrainJob -
  drops the default-on pod/deployment/statefulset webhook interception
  surface.
- Health check now asserts the quota CRs reconcile to Active
  (assert-only, read-only allowlist compliant); documented coupling to
  the default CR names for overlays overriding manifestFiles.
- Docs: registry field reference, catalog entry incl. upgrade/uninstall
  caveats and health-check coupling, BOM regen.

Signed-off-by: Carlos Eduardo Arango Gutierrez <[email protected]>
ArangoGutierrez added a commit to ArangoGutierrez/aicr that referenced this pull request Jul 10, 2026
Kueue was registered in the component registry but referenced by zero
overlays and shipped no queue or quota CRs, so a deployed Kueue admitted
nothing out of the box.

- Add registry-level manifestFiles defaults to ComponentConfig: a
  component can now ship default manifests wherever a recipe references
  it; ref-declared (overlay/mixin) lists take precedence. No opt-out:
  an empty ref-declared list is indistinguishable from absent — declare
  a replacement list to suppress the defaults.
- Fail closed at registry load when a Kustomize-typed component
  declares manifestFiles: validateComponentRef rejects the combination
  per-ref, so a registry-level mistake would otherwise surface at
  resolution time in every consumer at once.
- Mark kueue manifestsUseChartCRDs: the quota CRs instantiate CRDs the
  chart itself installs, so the injected kueue-post wrapper needs the
  helm-diff REST-mapper bypass (NVIDIA#914/NVIDIA#929 pattern, added in NVIDIA#1687).
- Bump kueue chart 0.17.1 -> 0.18.2 and ship default quota CRs
  (ResourceFlavor with GPU-taint toleration, ClusterQueue with
  admission-neutral quotas, LocalQueue default/default) as post-install
  hooks ordered by dependency.
- Pin managerConfig to the chart 0.18.2 default with
  integrations.frameworks trimmed to batch/job, JobSet, TrainJob -
  drops the default-on pod/deployment/statefulset webhook interception
  surface.
- Health check now asserts the quota CRs reconcile to Active
  (assert-only, read-only allowlist compliant); documented coupling to
  the default CR names for overlays overriding manifestFiles.
- Docs: registry field reference, catalog entry incl. upgrade/uninstall
  caveats and health-check coupling, BOM regen.

Review fixes (PR NVIDIA#1686 non-blocking review): mark manifestsUseChartCRDs on
kueue per NVIDIA#1687 coordination; fail closed at registry load when a
Kustomize-typed component declares manifestFiles; assert the load-time
guard returns ErrCodeInvalidRequest in its test; health-check, catalog,
and godoc coupling notes for manifestFiles overrides; single-default-flavor
toleration trade-off note.

Signed-off-by: Carlos Eduardo Arango Gutierrez <[email protected]>
ArangoGutierrez added a commit to ArangoGutierrez/aicr that referenced this pull request Jul 13, 2026
Kueue was registered in the component registry but referenced by zero
overlays and shipped no queue or quota CRs, so a deployed Kueue admitted
nothing out of the box.

- Add registry-level manifestFiles defaults to ComponentConfig: a
  component can now ship default manifests wherever a recipe references
  it; ref-declared (overlay/mixin) lists take precedence. No opt-out:
  an empty ref-declared list is indistinguishable from absent — declare
  a replacement list to suppress the defaults.
- Fail closed at registry load when a Kustomize-typed component
  declares manifestFiles: validateComponentRef rejects the combination
  per-ref, so a registry-level mistake would otherwise surface at
  resolution time in every consumer at once.
- Mark kueue manifestsUseChartCRDs: the quota CRs instantiate CRDs the
  chart itself installs, so the injected kueue-post wrapper needs the
  helm-diff REST-mapper bypass (NVIDIA#914/NVIDIA#929 pattern, added in NVIDIA#1687).
- Bump kueue chart 0.17.1 -> 0.18.2 and ship default quota CRs
  (ResourceFlavor with GPU-taint toleration, ClusterQueue with
  admission-neutral quotas, LocalQueue default/default) as post-install
  hooks ordered by dependency.
- Pin managerConfig to the chart 0.18.2 default with
  integrations.frameworks trimmed to batch/job, JobSet, TrainJob -
  drops the default-on pod/deployment/statefulset webhook interception
  surface.
- Health check now asserts the quota CRs reconcile to Active
  (assert-only, read-only allowlist compliant); documented coupling to
  the default CR names for overlays overriding manifestFiles.
- Docs: registry field reference, catalog entry incl. upgrade/uninstall
  caveats and health-check coupling, BOM regen.

Review fixes (PR NVIDIA#1686 non-blocking review): mark manifestsUseChartCRDs on
kueue per NVIDIA#1687 coordination; fail closed at registry load when a
Kustomize-typed component declares manifestFiles; assert the load-time
guard returns ErrCodeInvalidRequest in its test; health-check, catalog,
and godoc coupling notes for manifestFiles overrides; single-default-flavor
toleration trade-off note.

Signed-off-by: Carlos Eduardo Arango Gutierrez <[email protected]>
ArangoGutierrez added a commit to ArangoGutierrez/aicr that referenced this pull request Jul 14, 2026
Kueue was registered in the component registry but referenced by zero
overlays and shipped no queue or quota CRs, so a deployed Kueue admitted
nothing out of the box.

- Add registry-level manifestFiles defaults to ComponentConfig: a
  component can now ship default manifests wherever a recipe references
  it; ref-declared (overlay/mixin) lists take precedence. No opt-out:
  an empty ref-declared list is indistinguishable from absent — declare
  a replacement list to suppress the defaults.
- Fail closed at registry load when a Kustomize-typed component
  declares manifestFiles: validateComponentRef rejects the combination
  per-ref, so a registry-level mistake would otherwise surface at
  resolution time in every consumer at once.
- Mark kueue manifestsUseChartCRDs: the quota CRs instantiate CRDs the
  chart itself installs, so the injected kueue-post wrapper needs the
  helm-diff REST-mapper bypass (NVIDIA#914/NVIDIA#929 pattern, added in NVIDIA#1687).
- Bump kueue chart 0.17.1 -> 0.18.2 and ship default quota CRs
  (ResourceFlavor with GPU-taint toleration, ClusterQueue with
  admission-neutral quotas, LocalQueue default/default) as post-install
  hooks ordered by dependency.
- Pin managerConfig to the chart 0.18.2 default with
  integrations.frameworks trimmed to batch/job, JobSet, TrainJob -
  drops the default-on pod/deployment/statefulset webhook interception
  surface.
- Health check now asserts the quota CRs reconcile to Active
  (assert-only, read-only allowlist compliant); documented coupling to
  the default CR names for overlays overriding manifestFiles.
- Docs: registry field reference, catalog entry incl. upgrade/uninstall
  caveats and health-check coupling, BOM regen.

Review fixes (PR NVIDIA#1686 non-blocking review): mark manifestsUseChartCRDs on
kueue per NVIDIA#1687 coordination; fail closed at registry load when a
Kustomize-typed component declares manifestFiles; assert the load-time
guard returns ErrCodeInvalidRequest in its test; health-check, catalog,
and godoc coupling notes for manifestFiles overrides; single-default-flavor
toleration trade-off note.

Signed-off-by: Carlos Eduardo Arango Gutierrez <[email protected]>
mohityadav8 pushed a commit to mohityadav8/aicr that referenced this pull request Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/bundler area/docs area/recipes size/L theme/deployer Helm, ArgoCD, and deployment bundle generation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

helmfile: fresh-cluster apply fails diff on -post wrappers referencing parent-shipped CRDs

2 participants