Skip to content

feat(bundle): multi-tenant Argo deploy options - #1656

Merged
mchmarny merged 12 commits into
mainfrom
feat/argo-deployer-options
Jul 8, 2026
Merged

mchmarny merged 12 commits into
mainfrom
feat/argo-deployer-options

Conversation

@mchmarny

@mchmarny mchmarny commented Jul 8, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds a reserved --set deployer:<key>=<value> vocabulary (namePrefix, destinationServer, project, cascadeDelete) that parameterizes generated Argo CD Applications for multi-tenant and remote-cluster installs — bundle-time for both argocd and argocd-helm deployers, plus install-time helm --set deployer.<key>=... overrides for argocd-helm.

Motivation / Context

Generated Argo Application wrapper fields (child names, spec.destination.server, spec.project) were hardcoded, blocking installs of the same bundle across tenants, namespaces, and clusters; deleting the parent Application also left managed resources behind (no finalizer option). Design follows the consensus posted on both issues.

Fixes: #1625
Fixes: #1628
Related: N/A

Type of Change

  • New feature (non-breaking change that adds functionality)
  • Documentation update

Component(s) Affected

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

Implementation Notes

  • Allowlisted, fail-closed key set (pkg/bundler/config/argo_deployer.go): unknown deployer: keys, invalid values, non-Argo deployers, and the typed override path (--set-json/--set-file) are all rejected with ErrCodeInvalidRequest. The deployer name is reserved by a registry guard test.
  • Children-only scoping for namePrefix/destinationServer/project: the parent app-of-apps stays on the Argo CD control-plane cluster in project default — Application CRs are reconciled only from the cluster running Argo CD (apps-in-any-namespace broadens namespaces, not source clusters), and App-of-Apps is an admin-only pattern. Parent name remains covered by --app-name.
  • cascadeDelete adds resources-finalizer.argocd.argoproj.io to parent AND children (app deletion docs); bundle-time only, because metadata.finalizers is a list field that cannot round-trip as a Helm template expression.
  • argocd-helm install-time layering: baked values ship as chart defaults in the root values.yaml deployer: map; child templates read .Values.deployer.* with nil-safe sprig defaults. A live helm template test proves --set deployer.namePrefix=t- renders t-gpu-operator.
  • No behavior change without the options: default output is semantically equivalent for both deployers — the review-hardening commits quote name/project/server/namespace in the argocd templates (goldens re-pinned), so the YAML bytes differ by quoting only; parsed values are unchanged. argocd-helm default rendering is equivalent (fields templated with today's values as defaults).
  • Composed child names are validated as DNS-1123 subdomains at generation; destinationServer must be a credential-free https:// URL.

Testing

unset GITLAB_TOKEN
make qualify          # full gate: test (-race) + lint + e2e + scan — PASS
make test-coverage    # project floor — PASS

Coverage deltas (branch vs origin/main):

  • pkg/bundler: 72.5% → 72.9% (+0.4%)
  • pkg/bundler/config: 96.7% → 96.9% (+0.2%)
  • pkg/bundler/deployer/argocd: 81.2% → 82.9% (+1.7%)
  • pkg/bundler/deployer/argocdhelm: 81.8% → 81.8% (±0.0%)

New tests: allowlist parser table tests, generator option/rejection tests for both deployers, typed-override rejection, registry reserved-key tripwire, live helm template override render. argocd goldens unchanged; argocd-helm goldens regenerated (changes confined to the three templated child fields + values.yaml deployer: block).

Risk Assessment

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

Rollout notes: Backwards compatible — bundles generated without deployer: options are semantically unchanged (scalar quoting differs in argocd output; parsed manifests identical). No migration needed.

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

Adds a reserved --set deployer:<key>=<value> vocabulary (namePrefix,
destinationServer, project, cascadeDelete) parameterizing generated
Argo CD Applications for multi-tenant and remote-cluster installs.
Bundle-time for both argocd and argocd-helm deployers; argocd-helm
additionally exposes the string keys at install time via
helm --set deployer.<key>=... with baked defaults in values.yaml.
Child-only scoping for namePrefix/destinationServer/project; the
parent app-of-apps stays on the control-plane cluster. cascadeDelete
adds resources-finalizer.argocd.argoproj.io to parent and children.
Unknown keys, invalid values, non-Argo deployers, and the typed
override path are rejected fail-closed with ErrCodeInvalidRequest.

Fixes: #1625
Fixes: #1628
Signed-off-by: Mark Chmarny <[email protected]>
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Recipe evidence check

No leaf overlays affected by this PR.

This gate is warning-only and never blocks merge.

@github-actions

github-actions Bot commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

Coverage Report ✅

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

Merging this branch changes the coverage (1 decrease, 4 increase)

Impacted Packages Coverage Δ 🤖
github.com/NVIDIA/aicr/pkg/bundler 72.94% (+0.40%) 👍
github.com/NVIDIA/aicr/pkg/bundler/config 95.60% (-0.02%) 👎
github.com/NVIDIA/aicr/pkg/bundler/deployer/argocd 82.89% (+1.68%) 👍
github.com/NVIDIA/aicr/pkg/bundler/deployer/argocdhelm 82.37% (+0.52%) 👍
github.com/NVIDIA/aicr/pkg/cli 68.95% (ø)
github.com/NVIDIA/aicr/pkg/recipe 87.36% (+0.05%) 👍

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/NVIDIA/aicr/pkg/bundler/bundler.go 76.87% (+0.40%) 761 (+13) 585 (+13) 176 👍
github.com/NVIDIA/aicr/pkg/bundler/config/argo_deployer.go 95.45% (+95.45%) 44 (+44) 42 (+42) 2 (+2) 🌟
github.com/NVIDIA/aicr/pkg/bundler/config/config.go 94.59% (ø) 222 210 12
github.com/NVIDIA/aicr/pkg/bundler/deployer/argocd/argocd.go 82.89% (+1.68%) 187 (+22) 155 (+21) 32 (+1) 👍
github.com/NVIDIA/aicr/pkg/bundler/deployer/argocdhelm/argocdhelm.go 82.37% (+0.52%) 465 (+74) 383 (+63) 82 (+11) 👍
github.com/NVIDIA/aicr/pkg/cli/bundle.go 53.27% (ø) 199 106 93
github.com/NVIDIA/aicr/pkg/recipe/components.go 86.78% (+0.69%) 121 (+6) 105 (+6) 16 👍
github.com/NVIDIA/aicr/pkg/recipe/metadata.go 92.70% (+0.06%) 397 (+3) 368 (+3) 29 👍

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.

@coderabbitai

coderabbitai Bot commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

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

This PR adds reserved deployer: overrides for aicr bundle, wires parsed options into the argocd and argocd-helm generators, updates Argo Application rendering to support configurable name prefixes, destination servers, projects, and optional cascade-delete finalizers, reserves the deployer key in recipe loading, and updates API/CLI documentation and test fixtures.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related issues

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes implement the deployer options for multi-tenant/remote-cluster Argo bundles and the optional resources finalizer.
Out of Scope Changes check ✅ Passed All changes stay focused on deployer options, validation, docs, tests, and related manifests.
Title check ✅ Passed The title is concise and clearly points to the new Argo deploy options for bundling.
Description check ✅ Passed The description directly matches the reserved deployer options, validation, docs, and deployer support added in the changeset.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/argo-deployer-options

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

coderabbitai[bot]

This comment was marked as resolved.

Review-fix wave for the --set deployer:<key> vocabulary (PR #1656):

- Quote templated scalars (name/project/server) in the argocd child
  Application template so YAML reserved scalars round-trip as strings.
- Tighten destinationServer charset (no quotes/spaces/control chars)
  via new exported ValidateDestinationServer; ValidateNamePrefix
  exported and applied at both generator boundaries.
- Emit values.schema.json in argocd-helm bundles: unknown or malformed
  deployer.* keys fail at helm install/template time (fail closed).
- Prepend a template guard to every argocd-helm child: install-time
  deployer.namePrefix overrides that exceed Helm's 53-char release-name
  cap or collide with the parent Application name fail the render;
  matching bundle-time checks added in both deployers
  (argocd.HelmReleaseNameMaxLen).
- Enforce the reserved 'deployer' component name / override key at
  registry load for embedded and external --data registries alike
  (recipe.ReservedDeployerKey, constant-equality test in bundler/config).
- Docs: remote-destination prerequisites (cluster registration, project
  permissions), name limits, and the values.schema.json gate.
- Nitpicks: sorted deployer option key iteration for deterministic
  errors; concrete DNS-1123 violation in project errors; upfront
  NamePrefix validation covering zero-folder recipes.

Signed-off-by: Mark Chmarny <[email protected]>
Comment thread pkg/bundler/config/argo_deployer.go Resolved
@mchmarny

mchmarny commented Jul 8, 2026 •

Copy link
Copy Markdown
Member Author

Fixed:

  • Install-time fail-open — argocd-helm bundles now ship a values.schema.json scoped to the deployer key (additionalProperties: false + type/pattern validation), so helm install --set deployer.destinationSever=... fails loudly instead of silently targeting the in-cluster default. Root-level properties stay open for component override maps.
  • Helm 53-char release-name cap — composed child names are rejected at generation in both deployers, and argocd-helm child templates carry a fail-based guard for install-time deployer.namePrefix overrides (Argo CD defaults the Helm release name to the Application name).
  • Parent/child name collision (--app-name tenant-cert-manager + namePrefix=tenant-) — rejected at generation in both deployers, plus an install-time template guard mirroring the parent's appName fallback.
  • YAML type/quoting safety — name/project/destination.server are now %q-quoted in the argocd templates (project=true renders as the string "true", not a boolean), and destinationServer rejects quotes/whitespace/control characters at parse time and in the schema pattern (a validator-accepted URL with an apostrophe previously broke the single-quoted Helm expression).
  • Reserved deployer key — now enforced at registry load (single choke point covering embedded and external --data registries), not just by the tripwire test; a cross-package test pins the constant equality.
  • Docs — remote-destination prerequisites (cluster must be registered with Argo CD, AppProject must permit the emitted destinations/sources) and the new name-length/collision limits are documented in the CLI reference.

Not changed — destination-namespace support: the consensus on #1625 explicitly deferred namespace remapping pending a concrete variant (per-tenant prefix vs. single shared namespace) — destinationServer + namePrefix cover the remote-cluster and shared-Argo-namespace cases raised there, and remapping can break namespace-coupled chart values. Opened #1658 to track it as a follow-up; this PR still closes #1625 per that consensus.

Full gate (make qualify) and coverage floor pass on the updated branch.

njhensley
njhensley previously approved these changes Jul 8, 2026

@njhensley njhensley left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

📋 Multi-persona review — PR #1656 · feat(bundle): multi-tenant Argo deploy options

Method: 4 persona passes (Correctness · Security · Domain/Architecture · Test-coverage/Operability), each finding independently confirmed or refuted by a senior meta-reviewer against the resolved code. Line links pinned to head 6e75d979.
Tier legend: 🔴 Blocker · 🟠 Major · 🟡 Minor · 🔵 Nitpick · ✅ Confirmed non-issue

Overall assessment — Approve with comments

This is a high-quality, thoroughly-tested PR. The security-sensitive surface — user values rendered into Argo Application YAML — is handled well: the bundle-time path validates through an allowlist (ParseArgoDeployerOptions) and double-escapes with printf "%q"; the argocd-helm path emits single-quoted scalars with a schema that bans quotes/whitespace. No injection, no blockers, no majors. The finalizer-on-both-parent-and-children cascade model, the "children-only / parent-stays-in-cluster-default" app-of-apps design, the reserved-key layering seam with its cross-package equality test, and determinism (struct-ordered values.schema.json with a byte-golden) are all correct.

The one theme worth a follow-up: the argocd-helm install-time values.schema.json is a hand-rolled, weaker mirror of the bundle-time Go validators, so a value rejected at aicr bundle can slip through at helm install. Both instances (inline) are low blast-radius — bad value → child Application fails to sync, no crash, no breakout — hence Minor, but they're real drift sharing one root cause.

Summary-only notes (land on unchanged context / non-code)

  • 🔵 CI helm fragility (.github/actions/go-test/action.yml): the install-time guard/schema tests (TestHelmTemplate_*) t.Skip when helm is absent, and the go-test action installs only Go + envtest. They run today only because ubuntu-latest ships helm ambiently (unpinned) — unlike the repo's setup-build-tools which pins a version. Not a live gap, but a pinned azure/setup-helm step (or a CI env that makes absence fail rather than skip) would keep the safety net from silently disappearing.
  • 🔵 PR-description wording: "argocd deployer default output is byte-identical" — the goldens now quote scalars (name: "gpu-operator", project: "default", server: "https://…"), so it's semantically equivalent, not byte-identical. Worth softening the claim (the %q quoting is also what makes the non-helm path injection-safe, so it's a good change).
  • 🔵 Docs: consider a one-liner that (a) deployer:destinationServer supports only spec.destination.server, not destination.name (name-registered clusters won't resolve), and (b) cascadeDelete=true bakes the resources-finalizer, which blocks kubectl delete application if Argo CD is already gone (the classic stuck-Terminating trap).

✅ Confirmed non-issues (checked and cleared)

  • YAML / Helm-template injection — clean on both paths. Bundle-time renders via printf "%q" on pre-validated inputs; install-time uses single-quoted yaml.Node scalars with schema-banned quotes/whitespace; {{…}} in a .Values lookup is emitted as inert text (Helm is single-pass). The childNameGuard printf interpolates only registry-controlled componentName (%q) + a constant.
  • Finalizer strings.Replace injection — anchor " namespace: argocd\nspec:" occurs exactly once in parentAppTemplate; the !Contains(ResourcesFinalizer) fail-loud guard is sound.
  • Length/collision math — Go > 53 and guard gt (len …) 53 agree (no off-by-one); the appName | default "aicr-stack" fallback matches across guard, parent template, and the Go collision check.
  • Cross-deployer parity — the four options render equivalently across argocd and argocd-helm; cascadeDelete is bundle-time-only in both.
  • Determinism — values.schema.json is struct-ordered and pinned by a byte-golden (TestBundleGolden_HelmAndManifestOnly).
  • Fail-closed integrity — argoDeployerOptions() runs unconditionally before the deployer switch; rejects typed (--set-json/--set-file) overrides, unknown keys, and the deployer: prefix on non-Argo deployers; registry guard fails closed for embedded + --data registries; cross-package constant equality pinned.
  • "multi-tenant" scope — correctly delivers per-tenant naming/placement, not AppProject RBAC isolation (honestly documented in the Project field comment).

Summary

Tier Count Items
🔴 Blocker 0 —
🟠 Major 0 —
🟡 Minor 2 install-time schema accepts credentialed destinationServer; install-time project schema looser than DNS-1123
🔵 Nitpick 5 opaque cascadeDelete install error · 53-cap on non-Helm children · duplicated default literals · CI helm fragility · "byte-identical" wording (+ optional doc notes)

Recommendation: Approve with comments. No blockers or majors. The two Minors share one root cause — the install-time values.schema.json diverging from the Go validators — and are worth a follow-up (ideally generating one from the other); everything else is optional polish.

🤖 Generated with multi-persona review + adversarial meta-review.

@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: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pkg/bundler/deployer/argocd/argocd.go (1)

437-445: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use a project-specific validator message
ValidateAppName hardcodes invalid app name ..., so g.Project will report the wrong field. Add a project-specific wrapper or make the helper accept a label, and apply the same fix in pkg/bundler/deployer/argocdhelm/argocdhelm.go.

🤖 Prompt for 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.

In `@pkg/bundler/deployer/argocd/argocd.go` around lines 437 - 445, The validation
path currently reports the wrong field because ValidateAppName hardcodes an
app-name error message while being used for g.Project. Update the Argocd
deployer validation flow to use a project-specific validator message, either by
adding a wrapper or by changing bundlercfg.ValidateAppName to accept a field
label and using it for g.Project; apply the same change in ArgocdHelm validation
so both Argocd and ArgocdHelm report the correct field name.
🤖 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 `@pkg/bundler/config/argo_deployer.go`:
- Around line 142-147: The deployer project override handling in the config
parsing logic currently validates an empty string as an invalid DNS subdomain,
which prevents unset overrides from working. Update the deployerKeyProject
branch in the argo deployer config parsing to treat "" as unset, consistent with
the namePrefix and destinationServer behavior, so that Generator.project() can
fall back to default when opts.Project is empty. Keep the validation only for
non-empty values and preserve the existing opts.Project assignment for valid
inputs.

In `@pkg/bundler/deployer/argocd/templates/application.yaml.tmpl`:
- Around line 40-41: The destination block in the Application template is
inconsistent because `namespace` is still emitted unquoted while `name`,
`project`, and `server` use explicit quoting. Update the template in the
`application.yaml.tmpl` destination section so `namespace` is escaped the same
way as the other fields, keeping the quoting policy uniform and aligned with the
existing `printf "%q"` handling.

---

Outside diff comments:
In `@pkg/bundler/deployer/argocd/argocd.go`:
- Around line 437-445: The validation path currently reports the wrong field
because ValidateAppName hardcodes an app-name error message while being used for
g.Project. Update the Argocd deployer validation flow to use a project-specific
validator message, either by adding a wrapper or by changing
bundlercfg.ValidateAppName to accept a field label and using it for g.Project;
apply the same change in ArgocdHelm validation so both Argocd and ArgocdHelm
report the correct field name.
🪄 Autofix (Beta)

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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 5c1e245e-085e-47b6-a789-b33f11217c97

📥 Commits

Reviewing files that changed from the base of the PR and between b21c356 and 7d20130.

📒 Files selected for processing (29)
  • docs/user/cli-reference.md
  • pkg/bundler/config/argo_deployer.go
  • pkg/bundler/config/argo_deployer_test.go
  • pkg/bundler/deployer/argocd/argocd.go
  • pkg/bundler/deployer/argocd/argocd_test.go
  • pkg/bundler/deployer/argocd/templates/application.yaml.tmpl
  • pkg/bundler/deployer/argocd/testdata/helm_and_kustomize/001-cert-manager/application.yaml
  • pkg/bundler/deployer/argocd/testdata/helm_and_kustomize/002-my-kustomize-app/application.yaml
  • pkg/bundler/deployer/argocd/testdata/helm_and_manifest_only/001-cert-manager/application.yaml
  • pkg/bundler/deployer/argocd/testdata/helm_and_manifest_only/002-nodewright-customizations/application.yaml
  • pkg/bundler/deployer/argocd/testdata/kustomize_only/001-my-kustomize-app/application.yaml
  • pkg/bundler/deployer/argocd/testdata/mixed_component/001-gpu-operator/application.yaml
  • pkg/bundler/deployer/argocd/testdata/mixed_component/002-gpu-operator-post/application.yaml
  • pkg/bundler/deployer/argocd/testdata/mixed_with_pre/001-gpu-operator-pre/application.yaml
  • pkg/bundler/deployer/argocd/testdata/mixed_with_pre/002-gpu-operator/application.yaml
  • pkg/bundler/deployer/argocd/testdata/mixed_with_pre/003-gpu-operator-post/application.yaml
  • pkg/bundler/deployer/argocd/testdata/readiness_gate/001-gpu-operator/application.yaml
  • pkg/bundler/deployer/argocd/testdata/readiness_gate/002-gpu-operator-readiness/application.yaml
  • pkg/bundler/deployer/argocdhelm/argocdhelm.go
  • pkg/bundler/deployer/argocdhelm/argocdhelm_test.go
  • pkg/bundler/deployer/argocdhelm/testdata/helm_and_manifest_only/templates/cert-manager.yaml
  • pkg/bundler/deployer/argocdhelm/testdata/helm_and_manifest_only/templates/nodewright-customizations.yaml
  • pkg/bundler/deployer/argocdhelm/testdata/helm_and_manifest_only/values.schema.json
  • pkg/bundler/deployer/argocdhelm/testdata/mixed_component/templates/gpu-operator-post.yaml
  • pkg/bundler/deployer/argocdhelm/testdata/mixed_component/templates/gpu-operator.yaml
  • pkg/bundler/deployer/argocdhelm/testdata/readiness_gate/templates/gpu-operator-readiness.yaml
  • pkg/bundler/deployer/argocdhelm/testdata/readiness_gate/templates/gpu-operator.yaml
  • pkg/recipe/components.go
  • pkg/recipe/components_test.go

Comment thread pkg/bundler/config/argo_deployer.go Resolved
- forbid @ in destinationServer schema pattern (embedded credentials)
- tighten project schema pattern to exact per-label DNS-1123 subdomain form
- document deployer.cascadeDelete as bundle-time only in values.yaml header and schema doc
- soften 53-cap messages: Helm release name derivation applies to Helm-rendered children; cap kept uniform for one invariant
- interpolate argocd.DefaultProject/DefaultDestinationServer into child templates instead of duplicated literals

Signed-off-by: Mark Chmarny <[email protected]>

@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

🤖 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 `@pkg/bundler/deployer/argocdhelm/argocdhelm_test.go`:
- Around line 2207-2253: Extend TestValuesSchemaPatterns to also assert that the
generated schema keeps deployer.additionalProperties disabled; after
unmarshalling values.schema.json into valuesSchema, check the Deployer schema
field on schema.Properties.Deployer and fail the test if AdditionalProperties is
true. This should sit alongside the existing regex assertions so the test pins
both the pattern behavior and the fail-closed schema shape produced by
writeValuesSchema.
🪄 Autofix (Beta)

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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: d08f5527-5e40-49ab-8c55-3927c3811630

📥 Commits

Reviewing files that changed from the base of the PR and between 7d20130 and 24d4784.

📒 Files selected for processing (12)
  • pkg/bundler/deployer/argocd/argocd.go
  • pkg/bundler/deployer/argocdhelm/argocdhelm.go
  • pkg/bundler/deployer/argocdhelm/argocdhelm_test.go
  • pkg/bundler/deployer/argocdhelm/testdata/helm_and_manifest_only/templates/cert-manager.yaml
  • pkg/bundler/deployer/argocdhelm/testdata/helm_and_manifest_only/templates/nodewright-customizations.yaml
  • pkg/bundler/deployer/argocdhelm/testdata/helm_and_manifest_only/values.schema.json
  • pkg/bundler/deployer/argocdhelm/testdata/helm_and_manifest_only/values.yaml
  • pkg/bundler/deployer/argocdhelm/testdata/mixed_component/templates/gpu-operator-post.yaml
  • pkg/bundler/deployer/argocdhelm/testdata/mixed_component/templates/gpu-operator.yaml
  • pkg/bundler/deployer/argocdhelm/testdata/mixed_component/values.yaml
  • pkg/bundler/deployer/argocdhelm/testdata/readiness_gate/templates/gpu-operator-readiness.yaml
  • pkg/bundler/deployer/argocdhelm/testdata/readiness_gate/templates/gpu-operator.yaml

njhensley
njhensley previously approved these changes Jul 8, 2026

@njhensley njhensley left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

✅ Re-approve on ba4f8fd3 — all review feedback addressed.

Verified the follow-up commits against my earlier findings:

  • 🟡 destinationServer credential parity — schema pattern tightened to ^https://[^'"\s@]+$, matching the bundle-time ValidateHTTPSURL credential rejection. Pinned by TestValuesSchemaPatterns (https://u:p@host:6443 now rejected).
  • 🟡 project DNS-1123 parity — schema now enforces exact per-label form (≤63/label, no empty labels); a..b is rejected, matching IsDNS1123Subdomain.
  • 🔵 cascadeDelete UX — documented as bundle-time-only in the schema comment and the values.yaml install header.
  • 🔵 53-char cap message — reworded to be accurate for non-Helm children (uniform cap kept by design as a single invariant).
  • 🔵 Duplicated defaults — now reference argocd.DefaultProject / argocd.DefaultDestinationServer.

values.schema.json golden regenerated to match, and a new fail-open guard test asserts additionalProperties: false is emitted. No blockers, no majors. LGTM.

Comment thread pkg/recipe/components.go Resolved
Comment thread pkg/bundler/deployer/argocd/argocd.go Resolved
Comment thread docs/user/cli-reference.md Resolved
Comment thread docs/user/cli-reference.md Resolved
@yuanchen8911

Copy link
Copy Markdown
Contributor

Three notes that do not anchor to changed lines:

CI does not install Helm for unit tests. .github/actions/go-test/action.yml sets up Go and envtest only, and the two new Helm-dependent test functions (covering four scenarios) skip silently when helm is not on PATH. They currently run only because the runner image bundles Helm — 3.x, while .settings.yaml pins v4.2.2 — so the install-time schema/guard behavior is validated against a different Helm major than the project pins, and would silently drop out of CI if the runner image changes. Suggest installing the pinned Helm in the go-test action and making these tests fail rather than skip when CI is set.

Validation-contract drift. The destinationServer/project/namePrefix findings on this PR are all instances of the install-time gate (schema pattern or template guard) diverging from the bundle-time Go validators — in both directions. A parity test would close the class: drive the same inputs through the Go validator and through helm template against a generated chart (--set-string), each case asserting an explicit wantValid — asserting the two paths merely agree with each other would miss shared bugs such as both accepting https://:6443. Include live plain --set cases for true/false/123/0/null, since Helm type inference is outside anything a regex can validate.

PR body wording. The "byte-identical" claim for the argocd deployer is not accurate — the twelve argocd goldens each changed four scalars from unquoted to quoted (name, project, server, namespace). The output is semantically equivalent, not byte-identical; suggest rewording to avoid overstating the compatibility guarantee.

mchmarny and others added 3 commits July 8, 2026 10:59
Reject uppercase scheme and '@' anywhere in deployer destinationServer
so the bundle-time validator exactly mirrors the install-time schema
pattern; parity and parser tests extended; go-test README examples gain
the new helm_version input.

Signed-off-by: Mark Chmarny <[email protected]>
@mchmarny
mchmarny requested a review from a team as a code owner July 8, 2026 18:35
@mchmarny

mchmarny commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

All three addressed, @yuanchen8911 — and the second one paid for itself immediately.

CI Helm install — 62f14aeb (originally 687cf26a): .github/actions/go-test now installs the .settings.yaml-pinned Helm (v4.2.2, sha256-verified, replacing the runner's stock 3.x) via the same load-versions flow the other tool installs use, and the 8 Helm-dependent test sites now route through a shared requireHelm(t) that fails (not skips) when CI is set and helm is missing.

Validation-contract parity test — added as TestValidationContractParity: every case carries an explicit wantValid and is asserted against BOTH the Go validators and a live helm template run — exactly to catch shared bugs, and it caught two real ones on the first run:

  • https://:6443 was accepted by ValidateHTTPSURL (u.Host is ":6443", non-empty) — fixed by checking u.Hostname(), which also hardens the shared fulcio/rekor endpoint validation (IPv6 literals verified unaffected).
  • IsDNS1123Subdomain doesn't enforce the per-label 63-char cap (only the 253 total), so a 64-char project label passed bundle-time but failed the schema — new config.ValidateProject closes it.

The type-inference cases are in too (--set deployer.project=true/false/123/0 all fail the schema's type: string; =null deletes the key and correctly renders the baked default — pinned with a comment). A follow-up commit also closed the two residual drifts the parity review then surfaced (HTTPS:// uppercase scheme, @ in path) — the gate is now mirror-exact in both directions.

PR body — reworded: the argocd output is semantically equivalent, not byte-identical (the hardening commits quote name/project/server/namespace; goldens re-pinned).

@yuanchen8911

Copy link
Copy Markdown
Contributor

Verified at 62f14ae: the CI gap and the parity-test recommendation from the earlier note are both addressed — the go-test action now installs the Helm version pinned in .settings.yaml and the live-render tests fail (rather than skip) when helm is missing in CI, and TestValidationContractParity drives the bundle-time Go validators and helm template against explicit per-case wantValid, including plain --set type-inference cases. Remaining open items from this review: the appName toString guard crash, the delegated generator's parent name, the reserved deployer recipe-input boundary, and the two documentation notes (finalizer cleanup section, --set-string).

mchmarny and others added 2 commits July 8, 2026 11:57
- coerce appName via toString in childNameGuard so --set appName=true
  (Helm type inference) no longer crashes eq at render time
- forward the effective parent AppName to the inner argocd.Generator so
  its parent-collision check tests against this deployer's parent, not
  the inner nvidia-stack default
- reject componentRefs named with the reserved deployer key at
  RecipeResult.PrepareAndValidate (CLI and API fail closed, disabled
  refs included)
- mirror IsDNS1123Subdomain exactly for deployer project: drop the
  per-label 63-char cap (64+-char labels are legal k8s object names)
  and allow explicit-empty project/destinationServer at install time
  to reset to baked defaults
- docs: qualify the argocd cleanup section for cascadeDelete bundles
- docs: document --set-string for type-inferred deployer.* values

Signed-off-by: Mark Chmarny <[email protected]>
@mchmarny

mchmarny commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

Thanks for the verification, @yuanchen8911. The five remaining items from your list all landed in 40a4e0f (each thread has an inline reply with details): the toString coercion in the child-name guard, the effective parent name forwarded to the delegated generator, the reserved deployer rejection at RecipeResult.PrepareAndValidate (covers hand-authored recipes on both the CLI and API paths, disabled refs included), and both doc corrections (finalizer cleanup section qualified + --set-string documented). All review threads are now resolved; make qualify passes on the head.

@yuanchen8911

Copy link
Copy Markdown
Contributor

/lgtm

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

All review findings verified fixed at 40a4e0f — bundle-time and install-time validation confirmed aligned end-to-end (helm template matrix + Go validator probes), parity test and pinned-Helm CI in place, docs updated.

@mchmarny
mchmarny enabled auto-merge (squash) July 8, 2026 19:33
@mchmarny
mchmarny merged commit 038ae9c into main Jul 8, 2026
162 checks passed
@mchmarny
mchmarny deleted the feat/argo-deployer-options branch July 8, 2026 19:49
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(bundle): parameterize Argo resource finalizer feat(bundle): support multi-tenant Argo deploy options

3 participants