Skip to content

fix(helm): validate external Grove before operator installation - #16546

Merged
sttts merged 6 commits into
mainfrom
sttts-dyn-4953-grove-helm-preflight
Oct 16, 2026
Merged

sttts merged 6 commits into
mainfrom
sttts-dyn-4953-grove-helm-preflight

Conversation

@sttts

@sttts sttts commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Important

Flux requirement: use a helm-controller build/release containing fluxcd/helm-controller#1604. The tested helm-controller v1.6.5 (Flux v2.9.6, Helm SDK v4.2.4) panics on helm.sh/hook-output-log-policy. The upstream fix initializes the missing callback; it does not forward hook logs into Flux status/events. As of this update, #1604 is open and no containing release version is available, so a numeric minimum cannot yet be specified. The annotation remains enabled; the concrete incompatibility diagnosis is available in retained Job logs for Flux and Argo CD.

Summary

External Grove can expose the expected APIs while its controller is too old to inject GROVE_PCSG_POD_INDEX, causing new Dynamo multinode workers to fail at startup.

Add a read-only Helm pre-install,pre-upgrade Job that blocks before applying the operator Deployment. It checks the Grove controller image version, completed rollout, and presence of established Grove CRDs. No live operator changes and no mutation/adoption of external Grove resources.

Failure UX: The Job name ends in check-grove-compatibility, making the failed check identifiable in generic hook errors from Helm/Flux/Argo CD. Helm 3.18+ prints the failed Job logs automatically, including the detected incompatible Grove version and the required upgrade, before the final hook error. Older Helm versions require reading the retained Job logs manually.

image

Configuration and compatibility

The gate defaults on for external Grove only:

global:
  grove:
    enabled: true
    install: false

Discovery requires exactly one Deployment containing a grove-operator container. Select a controller explicitly when necessary:

dynamo-operator:
  grovePreflight:
    namespace: grove-system
    deploymentName: grove-operator

deploymentName without namespace is invalid. The current minimum is Grove v0.1.0-alpha.15; alpha.N and stable release tags are supported, including tags paired with digests. Custom/RC tags, digest-only images, missing/ambiguous controllers, incomplete rollouts, missing/unestablished CRDs, and API errors fail the gate.

This checks CRD availability, not exact schema/version compatibility. Upgrade external Grove and matching CRDs before Dynamo. Tags must accurately identify controller contents.

The Job runs Python's standard library with read-only RBAC, a non-root user, a read-only filesystem, a 120-second deadline, and two retries. Override image/imagePullSecrets for an internal registry. Hook dependencies run before the Job; successful Jobs are removed and failed logs retained. helm.sh/hook-output-log-policy: hook-failed makes Helm 3.18+ print failed Job logs directly, using the installer's Pod/log read permissions. Supporting RBAC/ServiceAccount hooks persist and need manual removal when retiring the release.

Helm and Flux execute the hooks; Argo CD maps them to PreSync. Raw kubectl apply, selective sync, or disabled hooks do not enforce the gate. Order separately managed Grove upgrades first. For installations with a separate compatibility gate, explicitly opt out:

dynamo-operator:
  grovePreflight:
    enabled: false

Preflight scheduling and OpenShift

grovePreflight.affinity defaults to {} and is independent of controllerManager.affinity, so a pre-install Job cannot inherit controller-specific pod affinity and wait for the Deployment it gates. Tolerations continue to follow the controller configuration.

grovePreflight.podSecurityContext: null preserves the previous secure defaults (runAsNonRoot: true, runAsUser: 65532, seccompProfile.type: RuntimeDefault). An explicit map fully replaces that pod context; {} omits it. For OpenShift, omit runAsUser and let SCC admission assign the namespace UID:

dynamo-operator:
  grovePreflight:
    affinity: {}
    podSecurityContext:
      runAsNonRoot: true
      seccompProfile:
        type: RuntimeDefault

These settings apply only to the hook Pod and take effect on the next install/upgrade. Container hardening remains enabled. OpenShift admission itself has not been tested; chart regression tests verify UID omission through the umbrella chart, custom UIDs, unchanged defaults, and independent affinity.

What the user sees

For a chart archive built from this PR, an external-Grove install/upgrade looks like:

helm upgrade --install dynamo ./dynamo-platform-1.6.0.tgz \
  --namespace dynamo-system --create-namespace \
  --set global.grove.enabled=true \
  --set global.grove.install=false

Helm creates the preflight as a Kubernetes Job in dynamo-system and waits for it before applying the operator Deployment. On success, Helm continues its normal installation/upgrade output; it does not stream the checker's success message.

Illustrative Helm 3.18+ terminal output for an incompatible controller after the Job exhausts its retries (excerpts, not a captured live run). The Job annotation helm.sh/hook-output-log-policy: hook-failed prints the diagnosis before the final hook failure:

Grove preflight failed: External Grove v0.1.0-alpha.11 is incompatible. Upgrade Grove and matching CRDs to v0.1.0-alpha.15 or later.
...
Error: UPGRADE FAILED: pre-upgrade hooks failed: job dynamo-dynamo-operator-check-grove-compatibility failed: BackoffLimitExceeded

For a first installation, the equivalent prefix is Error: INSTALLATION FAILED: failed pre-install:. A Job exceeding its 120-second deadline can report DeadlineExceeded instead. Exact formatting depends on the Helm version and failure cause.

Fallback for Helm before 3.18, or when automatic log output cannot read Pod logs: the Job is still retained, so inspect its logs manually with an identity permitted to read Pod logs. The annotation does not guarantee automatic log display in Argo CD or every Helm SDK consumer.

kubectl logs -n dynamo-system \
  job/dynamo-dynamo-operator-check-grove-compatibility

Example log excerpt for Grove alpha.11:

Grove preflight failed: External Grove v0.1.0-alpha.11 is incompatible. Upgrade Grove and matching CRDs to v0.1.0-alpha.15 or later.

The new operator Deployment is not applied; an already running operator keeps running. Upgrade external Grove and its matching CRDs, then rerun Helm. The failed Job is retained for diagnosis and replaced on the next attempt.

Validation

  • make test: 77 Helm cases and four Python tests covering multiple success/failure scenarios passed.
  • Helm lint with external Grove enabled: passed.
  • Repository pre-commit checks: passed.
  • Live local kind test (Kubernetes v1.35.0), using the PR operator subchart and real Grove alpha.11/alpha.15 releases:
    • Original published template failed before the hook: whitespace trimming commented out its first apiVersion. Fixed in ce5f0b9dc5 with a regression assertion.
    • Helm CLI v3.19.0: incompatible-version logs printed before hook failure, as intended.
    • Argo CD v3.5.5: failed PreSync blocks the operator Deployment; concrete version diagnosis remains in retained Job logs, while the main sync message is generic.
    • Flux v2.9.6 / helm-controller v1.6.5: annotation enabled causes the upstream panic noted above; a build containing feat: Various KVBM improvements #1604 has not yet been tested. Annotation removed: Ready=False / InstallFailed, retained logs contain the diagnosis, and no operator Deployment is applied.
    • After actual Grove alpha.15 and matching CRDs upgrade, Flux without log forwarding and Argo CD both pass the hook and create the operator Deployment. Argo sync succeeds; Flux reports Ready=True with workload waiting disabled for this gate-only recovery check.
    • Full operator health is not validated: its configured image could not be pulled in this environment (Init:ErrImagePull).

Related Issues

Closes DYN-4953

@sttts
sttts requested a review from a team as a code owner October 15, 2026 14:59
@github-actions github-actions Bot added fix documentation Improvements or additions to documentation deployment::k8s Relates to dynamo deployment in kubernetes labels Oct 15, 2026
@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: ai-dynamo/dynamo/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 753d4b4e-7486-4d52-913a-c330406bc22a
📥 Commits

Reviewing files that changed from the base of the PR and between 34101ca and 800ff4c.

📒 Files selected for processing: 11
  • deploy/helm/charts/platform/Makefile
  • deploy/helm/charts/platform/README.md
  • deploy/helm/charts/platform/README.md.gotmpl
  • deploy/helm/charts/platform/components/operator/files/grove-preflight/check.py
  • deploy/helm/charts/platform/components/operator/files/grove-preflight/compatibility.json
  • deploy/helm/charts/platform/components/operator/templates/grove-preflight.yaml
  • deploy/helm/charts/platform/components/operator/tests/test_grove_preflight.py
  • deploy/helm/charts/platform/components/operator/tests/update_grove_contract.py
  • deploy/helm/charts/platform/components/operator/values.yaml
  • deploy/helm/charts/platform/tests/grove_preflight_test.yaml
  • deploy/helm/charts/platform/values.yaml

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

Walkthrough

The platform chart adds a pre-install and pre-upgrade check for externally managed Grove. The check validates the controller version and rollout, then compares contracted CRD schemas with the chart’s compatibility data. Chart values, tests, and upgrade documentation cover the hook.

Changes

External Grove preflight

Layer / File(s) Summary
Compatibility checker and contract
deploy/helm/charts/platform/components/operator/files/grove-preflight/*, deploy/helm/charts/platform/components/operator/tests/*
The checker validates controller image versions, rollout status, and CRD schemas against compatibility data. Unit tests cover these checks. A script updates the contract from a matching Grove release tag.
Helm hook, configuration, and validation
deploy/helm/charts/platform/components/operator/templates/grove-preflight.yaml, deploy/helm/charts/platform/components/operator/values.yaml, deploy/helm/charts/platform/values.yaml, deploy/helm/charts/platform/tests/grove_preflight_test.yaml, deploy/helm/charts/platform/Makefile
The chart conditionally creates the preflight Job and its access-control resources. Values configure its image, deadline, and controller discovery. Helm tests cover rendering and overrides, and the test target runs Python unit tests.
Upgrade guidance
deploy/helm/charts/platform/README.md, deploy/helm/charts/platform/README.md.gotmpl
The upgrade notes describe activation conditions, checks, configuration, hook ordering, limitations, failure handling, and cleanup.

Priority: ⬇️ Low

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

Merge Risk: ⚪ Minimal · up to 800ff

The change adds an opt-out preflight check for external Grove before operator install or upgrade. No concrete merge-blocking risk was identified. It has not been run on a live cluster, so confirm it in a real install before relying on it.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 3.57% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 28 functions across 3 files. (8 skipped: 8… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly and concisely describes the primary change: validating external Grove before operator installation.
Description check Passed The description provides detailed scope, configuration, behavior, failure handling, validation results, and the required issue reference. It uses equivalent headings instead of the template's Overview…
Full details: Description check

Explanation

The description provides detailed scope, configuration, behavior, failure handling, validation results, and the required issue reference. It uses equivalent headings instead of the template's Overview, Details, and reviewer-start headings, but it is otherwise complete and directly related to the change.

Full details: Docstring Coverage

Explanation

Docstring coverage is 3.57% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 28 functions across 3 files. (8 skipped: 8 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Fix all pre-merge checks with AI
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@devin-ai-integration

devin-ai-integration Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

✅ Dynamo PR CI passed — run 38889367241 (attempt 1) on c83fec0ab1

Gate checks: ✅ backend-status-check · ✅ deploy-status-check · ✅ dynamo-status-check

Posted automatically by Devin for run 38889367241. Updated on every full-CI run of this PR.

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

LGTM, outside addressing Julien's comments and handling the Flux controller issue

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

Labels

deployment::k8s Relates to dynamo deployment in kubernetes documentation Improvements or additions to documentation fix size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants