Skip to content

feat: implement HIP-0025 resource creation sequencing#32038

Closed
caretak3r wants to merge 7 commits into
helm:mainfrom
caretak3r:feature/hip-0025
Closed

feat: implement HIP-0025 resource creation sequencing#32038
caretak3r wants to merge 7 commits into
helm:mainfrom
caretak3r:feature/hip-0025

Conversation

@caretak3r

@caretak3r caretak3r commented Apr 10, 2026

Copy link
Copy Markdown

What this PR does / why we need it

Implements HIP-0025: Better Support for Resource Creation Sequencing, adding native DAG-based ordering for resource groups and subcharts to Helm v4.

Today Helm applies all rendered manifests simultaneously. Application distributors who need ordered deployment must use hooks (tedious to maintain) or bake sequencing into the application itself (unnecessary complexity). HIP-0025 gives chart authors a first-class mechanism to define deployment order using annotations and Chart.yaml fields, and gives operators a --wait=ordered flag to enable sequenced execution.


Overview

When --wait=ordered is specified, Helm builds two levels of dependency graphs:

  1. Subchart DAG — orders subcharts based on depends-on fields in Chart.yaml dependencies and/or the helm.sh/depends-on/subcharts annotation.
  2. Resource-group DAG — within each chart level, orders groups of resources based on helm.sh/resource-group and helm.sh/depends-on/resource-groups annotations.

Resources are deployed in topological order (Kahn's algorithm). Helm waits for each batch to reach readiness before proceeding to the next. Readiness defaults to kstatus evaluation; chart authors can override it with custom JSONPath expressions via helm.sh/readiness-success and helm.sh/readiness-failure annotations supporting 6 operators (==, !=, <, <=, >, >=).

Execution Flow

┌─────────────────────────────────────────┐
│         Subchart DAG Resolution         │
│  (Chart.yaml depends-on / annotations)  │
└──────────────────┬──────────────────────┘
                   │
         ┌─────────▼──────────┐
         │  For each subchart  │◄─── topological batch order
         │  batch — recursive  │     (chartPath threaded through
         │  into nested deps   │      arbitrary nesting depth)
         └─────────┬──────────┘
                   │
    ┌──────────────▼──────────────┐
    │  Resource-Group DAG within  │
    │  each chart (annotations)   │
    └──────────────┬──────────────┘
                   │
         ┌─────────▼──────────┐
         │  Deploy group batch │
         │  Wait for readiness │──── kstatus or custom JSONPath
         │  Next group batch   │
         └────────────────────┘

Reverse-DAG order is used for uninstall and rollback of sequenced releases.


Commit Organization

This PR was previously organized as 7 stacked commits to aid review. Following review iterations and a rebase onto current upstream/main, it has been consolidated into 2 commits to keep the history clean:

# Commit Scope
1 feat: implement HIP-0025 resource creation sequencing The full implementation: generic DAG engine, resource-group + subchart parsers, two-level execution wired into install/upgrade/rollback/uninstall/template, lint rules, custom readiness, and tests.
2 fix(hip-0025): thread context through updateAndWait and chartPath through nested subcharts Addresses two findings from Copilot's most recent review of commit 1 (see Review Feedback below).

New Annotations

Annotation Scope Purpose
helm.sh/resource-group Resource Assigns the resource to a named group
helm.sh/depends-on/resource-groups Resource Declares resource-group ordering dependencies (JSON array)
helm.sh/depends-on/subcharts Chart.yaml Declares parent→subchart ordering dependencies (JSON array)
helm.sh/readiness-success Resource Custom JSONPath success conditions (OR semantics)
helm.sh/readiness-failure Resource Custom JSONPath failure conditions (OR semantics, takes precedence)

All six annotation keys match the HIP-0025 specification byte-for-byte. The helm.sh/depends-on/resource-groups and helm.sh/depends-on/subcharts keys contain multiple / (not valid Kubernetes qualified names) — these are stripped before SSA-applying to the API server, so K8s never sees them; they are consumed at render/sequencing time only.

New Chart.yaml Fields

  • depends-on on dependencies[] entries — declares subchart ordering dependencies by name or alias.

New CLI Flags

Flag Commands Description
--wait=ordered install, upgrade, rollback, uninstall Enables sequenced deployment / reverse-sequenced teardown
--readiness-timeout install, upgrade, rollback Per-batch readiness timeout (default 1m, must not exceed --timeout)

Schema Changes

  • DependsOn []string added to chart.Dependency (preserves backward compatibility — optional field).
  • SequencingInfo struct added to release.Release (Enabled bool, Strategy string). Persisted with the release so rollback/uninstall know to use sequenced flow.
  • OrderedWaitStrategy constant added to pkg/kube.

Key Design Decisions

  • Generic DAG engine. Topological sort decoupled from Helm-specific types, independently testable (pkg/chart/v2/util/dag.go).
  • Two-level execution. Subchart ordering decides when a chart is processed; resource-group ordering decides how resources within that chart are batched.
  • chartPath threading through recursion. Nested subchart manifests are routed correctly at arbitrary depth — parent → parent/charts/sub → parent/charts/sub/charts/nested.
  • Fixed-point cascade pruning. Resource groups whose dependencies reference unknown groups are pruned and emitted to the unsequenced (last) batch with a warning.
  • Backward compatibility. Charts without sequencing annotations behave identically to before. Releases created without --wait=ordered are upgraded/rolled back/uninstalled using the traditional single-batch flow. The SequencingInfo.Enabled flag gates the sequenced path on rollback and uninstall.
  • Hook exclusion. Hook resources are explicitly excluded from sequencing DAGs; they continue to use helm.sh/hook-weight as before.
  • Spec-faithful annotation keys. helm.sh/depends-on/resource-groups is invalid as a K8s annotation key (multiple /); it's stripped from manifests before SSA. helm template --wait=ordered output emits ## START/END delimiters and is not intended to be piped directly to kubectl apply.

Review Feedback Addressed

Joejulian's CHANGES_REQUESTED feedback (April 2026) has been addressed in commit 1:

  • subchart_dag.go — use ProcessDependencies-resolved chart state. BuildSubchartDAG now reads c.Dependencies() (post-processed: aliases applied, disabled deps pruned, conditions/tags resolved) instead of re-deriving enablement from chart.Metadata.Dependencies heuristics. Closes the misclassification path joejulian called out for conditions/tags/aliases.
  • sequencing.go — context cancellation through createAndWait. Added ctx.Done() select gates before Build, before Create, and before Wait. New test TestSequencedDeployment_CreateAndWait_RespectsContextCancellation covers the four cancellation points.

Latest Copilot review on the consolidated commit (May 3 2026) flagged two further issues, addressed in commit 2:

  • updateAndWait ignored its context arg. Sequenced upgrades and rollbacks did not honor cancellation through Build/Update/Wait. Now threaded with the same select gates as createAndWait.
  • GroupManifestsByDirectSubchart flattened nested subcharts. Used the bare chart name as path prefix; on recursion the prefix didn't match top-level-rooted manifest names. Now threads chartPath through deployChartLevel and deleteChartLevelReverse so each recursion level matches the full path. Added TestSequencing_GroupManifestsByDirectSubchart_Nested; updated the uninstall test that previously documented this as "a known limitation."

Deferred (tracked for follow-up issues, not blockers):

  • JSONPath compilation caching (perf-only; Copilot low-confidence).
  • Parallel execution within a subchart batch — current implementation is sequential within each batch; parallel execution is a tracked enhancement (needs error aggregation and log-interleaving handling) and can be added without breaking the interface.
  • Shared groupManifestsByChartPath helper between cmd/template.go and action/sequencing.go (acknowledged scope-deferred).
  • One-shot warning emission for partial readiness annotations (currently logged each poll iteration).
  • Stripping # Source: headers in normalizedManifestContent for uninstall path recovery.

How to Test

Unit tests:

make test-unit

# Sequencing-specific:
go test ./pkg/chart/v2/util/ -run TestDAG -v
go test ./pkg/chart/v2/util/ -run TestSubchart -v
go test ./pkg/release/v1/util/ -run TestResourceGroup -v
go test ./pkg/kube/ -run TestReadiness -v
go test ./pkg/action/ -run TestSequenc -v
go test ./pkg/action/ -run TestUninstall_Sequenced -v
go test ./pkg/chart/v2/lint/rules/ -run TestSequencing -v
go test ./pkg/cmd/ -run 'TestTemplate|TestReadinessTimeout|TestWaitFlag' -v

Integration tests (requires kind cluster):

kind create cluster --name helm-hip-0025

# Sequenced install with resource groups
helm install rg-demo ./testcharts/resource-groups --wait=ordered

# Subchart ordering (nested ≥3 levels exercises the chartPath fix)
helm install sc-demo ./testcharts/subchart-ordering --wait=ordered

# Custom readiness with JSONPath
helm install cr-demo ./testcharts/custom-readiness --wait=ordered --readiness-timeout 30s

# Template output with delimiters
helm template my-release ./testcharts/resource-groups --wait=ordered

# Reverse-sequenced uninstall
helm uninstall sc-demo --wait=ordered

# Lint
helm lint ./testcharts/circular-dep

kind delete cluster --name helm-hip-0025

Manual verification checklist:

  • Plain charts (no sequencing annotations) behave identically to before
  • helm template with --wait=ordered shows resource-group delimiters
  • helm lint errors on circular deps, partial readiness, orphan refs (ErrorSev)
  • Install/upgrade respects topological order of subcharts and resource groups
  • Rollback/uninstall processes groups in reverse order, recursing through nested subcharts
  • --readiness-timeout is honored per resource group; rejected when greater than --timeout
  • Releases store SequencingInfo when --wait=ordered is used; rollback/uninstall consult it

Reference Documents


Special notes for reviewers:

  • 52 files changed, +7110/−158 net. The consolidated history is intentional: linear rebase -i on the previous 19-commit branch produced N rounds of conflicts against current upstream after the Go-1.26 / k8s-1.36 merge; a one-shot 3-way merge --squash from a fresh branch on upstream/main resolved cleanly.
  • All unit tests pass: pkg/action, pkg/cmd, pkg/kube, pkg/chart/..., pkg/release/.... make lint / make vet clean.
  • DCO ✅ on both commits.

If applicable:

  • This PR contains documentation updates needed (companion: helm/helm-www#2068)
  • This PR contains unit tests
  • This PR has been tested for backwards compatibility

Signed-off-by: Rohit Gudi 50377477+caretak3r@users.noreply.github.com
refs https://github.com/helm/community/blob/main/hips/hip-0025.md

Copilot AI review requested due to automatic review settings April 10, 2026 22:36
@pull-request-size pull-request-size Bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Apr 10, 2026

Copilot AI 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.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Implements HIP-0025 ordered resource creation sequencing in Helm v4 by introducing DAG-based ordering for subcharts and resource groups, along with optional custom readiness evaluation and CLI support.

Changes:

  • Added generic DAG utilities plus subchart/resource-group DAG builders and parsers.
  • Implemented --wait=ordered execution across install/upgrade/rollback/uninstall and added --readiness-timeout.
  • Added ordered delimiter output for helm template, new lint rules, and extensive unit/integration test coverage.

Reviewed changes

Copilot reviewed 47 out of 47 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pkg/release/v1/util/resource_group.go Parses resource-group annotations and builds a DAG for ordered batching.
pkg/release/v1/util/resource_group_test.go Unit tests for resource-group parsing, warnings, and DAG behavior.
pkg/release/v1/release.go Adds SequencingInfo metadata to releases for rollback/uninstall behavior.
pkg/release/v1/release_test.go Tests JSON backward compatibility and round-tripping for SequencingInfo.
pkg/kube/readiness.go Adds custom readiness expression parsing and evaluation via JSONPath.
pkg/kube/readiness_test.go Unit tests for custom readiness evaluation and expression parsing.
pkg/kube/custom_readiness_status_reader.go Integrates custom readiness into kstatus waiting via a StatusReader.
pkg/kube/custom_readiness_status_reader_test.go Verifies waiter integration and status reader behavior.
pkg/kube/options.go Adds waiter option to enable the custom readiness status reader.
pkg/kube/client.go Adds OrderedWaitStrategy and wires in optional custom readiness readers.
pkg/kube/client_wait_strategy_test.go Tests waiter selection and error messaging for ordered strategy.
pkg/cmd/flags.go Adds --wait=ordered parsing support (where applicable) and --readiness-timeout.
pkg/cmd/flags_test.go Tests CLI flag acceptance/rejection and readiness-timeout validation.
pkg/cmd/install.go Wires --readiness-timeout and ordered wait handling into install command.
pkg/cmd/upgrade.go Wires --wait=ordered and --readiness-timeout into upgrade command.
pkg/cmd/template.go Adds ordered template rendering with resource-group delimiters and subchart ordering.
pkg/cmd/template_test.go Adds golden tests for ordered delimiter output and absence without ordered wait.
pkg/cmd/testdata/testcharts/sequenced-chart/Chart.yaml Test fixture chart for ordered template output.
pkg/cmd/testdata/testcharts/sequenced-chart/templates/aa-databases-configmap.yaml Test fixture manifest with resource-group annotation.
pkg/cmd/testdata/testcharts/sequenced-chart/templates/bb-app-configmap.yaml Test fixture manifest with depends-on resource-group annotation.
pkg/cmd/testdata/testcharts/sequenced-chart/templates/cc-unsequenced-configmap.yaml Test fixture manifest without sequencing annotations.
pkg/cmd/testdata/testcharts/sequenced-chart/charts/worker/Chart.yaml Test subchart fixture for ordered template output.
pkg/cmd/testdata/testcharts/sequenced-chart/charts/worker/templates/aa-worker-configmap.yaml Test subchart fixture manifest with resource-group annotation.
pkg/cmd/testdata/output/template-ordered-delimiters.txt Golden output verifying START/END delimiters and ordering.
pkg/chart/v2/util/dag.go Introduces generic DAG with deterministic batching and cycle detection.
pkg/chart/v2/util/dag_test.go Unit tests for DAG batching, cycles, and helper methods.
pkg/chart/v2/util/subchart_dag.go Builds subchart dependency DAG from Chart.yaml fields and annotation.
pkg/chart/v2/util/subchart_dag_test.go Unit tests for subchart DAG ordering, aliases, disabled deps, and errors.
pkg/chart/v2/dependency.go Adds depends-on field to chart dependencies for sequencing declarations.
pkg/chart/v2/dependency_json_test.go Tests JSON/YAML tags and backward compatibility for the new dependency field.
pkg/chart/v2/lint/lint.go Registers new sequencing lint rule.
pkg/chart/v2/lint/lint_test.go Validates sequencing rules are registered and produce expected errors.
pkg/chart/v2/lint/rules/sequencing.go Lint rules for subchart/resource-group cycles and readiness annotation completeness.
pkg/chart/v2/lint/rules/sequencing_test.go Tests sequencing lint behavior across error/warning scenarios.
pkg/chart/common/util/jsonschema.go Minor change to schema validation error formatting implementation.
pkg/action/action.go Refactors render pipeline to optionally return sorted manifests for sequencing-aware actions.
pkg/action/sequencing.go Adds sequenced deployment engine (two-level DAG, per-batch waits, annotation stripping).
pkg/action/sequencing_test.go Comprehensive tests for ordered installs, batching, timeouts, and hooks behavior.
pkg/action/install.go Adds ordered install execution path with per-batch readiness timeout.
pkg/action/upgrade.go Adds ordered upgrade execution path and sequencing metadata recording.
pkg/action/upgrade_sequenced_test.go Tests ordered upgrade behaviors including rollback-on-failure/cleanup and transitions.
pkg/action/rollback.go Adds ordered rollback execution path based on stored sequencing metadata.
pkg/action/rollback_sequenced_test.go Tests ordered rollback behavior, cleanup, and sequencing info preservation.
pkg/action/uninstall.go Adds ordered uninstall path using reverse DAG order when sequencing metadata is present.
pkg/action/uninstall_sequenced_test.go Tests sequenced uninstall reverse ordering, hooks, keep policy/history, and dry-run.
pkg/action/warning_system_test.go Tests slog warnings for partial readiness, isolated groups, and orphan dependencies.
pkg/action/backward_compat_test.go Verifies backward-compat behavior for ordered wait without annotations and legacy releases.
Comments suppressed due to low confidence (1)

pkg/kube/client.go:1

  • Because newCustomReadinessStatusReader() is prepended and its Supports() returns true for all kinds, enabling it changes which StatusReader is used for all resources in that wait (including those without custom readiness annotations). If the intent is to only affect resources that actually define both readiness annotations, consider tightening the enablement condition (e.g., only enable the reader when at least one resource in the batch has both annotations) to reduce behavior drift and minimize surprises in mixed batches.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/action/upgrade.go Outdated
Comment thread pkg/action/sequencing.go Outdated
Comment thread pkg/action/sequencing.go Outdated
promptless-for-oss pushed a commit to Promptless/oss-contrib-helm-helm-www that referenced this pull request Apr 10, 2026
Document the new resource sequencing feature in Helm v4, including:
- Resource group annotations and dependencies
- Subchart sequencing via Chart.yaml
- Custom readiness conditions with JSONPath
- CLI flags (--wait=ordered, --readiness-timeout)
- Lint rules for sequencing issues
- Execution order for install, upgrade, rollback, and uninstall

Refs: HIP-0025, helm/helm#32038
Signed-off-by: promptless[bot] <promptless[bot]@users.noreply.github.com>
@promptless-for-oss

Copy link
Copy Markdown

Promptless prepared a documentation update related to this change.

Triggered by helm/helm#32038

Created comprehensive documentation for HIP-0025 resource sequencing, covering the new --wait=ordered flag, resource group annotations, subchart ordering via Chart.yaml, custom readiness conditions with JSONPath, and lint rules for circular dependencies and orphan references.

Review at helm/helm-www#2068

Copilot AI review requested due to automatic review settings April 11, 2026 00:03

Copilot AI 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.

Pull request overview

Copilot reviewed 47 out of 47 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

pkg/kube/readiness.go:1

  • evaluateExpression parses JSONPath (jsonpath.New().Parse(...)) on every evaluation. During statusWaiter polling this can become hot (expressions × resources × poll iterations). To reduce overhead, consider compiling/parsing expressions once (e.g., parse the annotation JSON into a slice of pre-parsed {template, op, expected} structs and reuse compiled JSONPath objects) and reusing across polling iterations for the same resource/batch.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/chart/v2/util/subchart_dag.go Outdated
Comment thread pkg/action/uninstall.go Outdated
Comment thread pkg/action/rollback.go Outdated
Copilot AI review requested due to automatic review settings April 11, 2026 00:29

Copilot AI 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.

Pull request overview

Copilot reviewed 47 out of 47 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

pkg/kube/readiness.go:1

  • All JSONPath execution errors are currently swallowed and treated as 'condition not met'. This can hide real authoring errors (e.g., incorrect JSONPath that parses but fails at execution time due to type/indexing issues) and lead to resources waiting indefinitely with no actionable signal. Prefer returning an error for execution failures, or at least only suppress a narrow 'field not found / empty result' case while surfacing other failures with context (expression + JSONPath template).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/cmd/template.go Outdated
Comment thread pkg/cmd/template.go Outdated
Comment thread pkg/chart/v2/lint/rules/sequencing_test.go Outdated
Copilot AI review requested due to automatic review settings April 11, 2026 00:38

Copilot AI 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.

Pull request overview

Copilot reviewed 47 out of 47 changed files in this pull request and generated 6 comments.

Comments suppressed due to low confidence (1)

pkg/kube/readiness.go:1

  • readinessJSONPath()always prefixes the provided path with.status, which means an expression like {.status.phase} == "Ready"turns into{.status.status.phase}and will never match. This is easy to hit because several fixtures/tests in this PR use{.status.*}style. Consider either (a) explicitly documenting/enforcing that paths are relative to.status(so{.phase}), and updating fixtures accordingly, or (b) supporting both by stripping a leading .status/.status.prefix before prefixing, so{.status.phase}and{.phase}` behave the same.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/cmd/template.go Outdated
Comment thread pkg/action/rollback.go Outdated
Comment thread pkg/action/rollback.go Outdated
Comment thread pkg/action/sequencing.go Outdated
Comment thread pkg/action/sequencing.go Outdated
Comment thread pkg/chart/v2/lint/rules/sequencing.go Outdated
Copilot AI review requested due to automatic review settings April 12, 2026 12:18

Copilot AI 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.

Pull request overview

Copilot reviewed 47 out of 47 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

pkg/release/v1/util/resource_group.go:1

  • resourceGroupResourceID does not include namespace. If a chart renders same Kind/Name into multiple namespaces (possible via templating), ParseResourceGroups can falsely report “assigned to multiple resource groups” even though the resources are distinct. Include namespace in the identity when available (e.g., apiVersion/kind/namespace/name) to match Kubernetes object identity semantics.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/action/sequencing.go Outdated
Comment thread pkg/cmd/template.go Outdated
Comment thread pkg/cmd/template.go Outdated
Copilot AI review requested due to automatic review settings April 15, 2026 09:40

Copilot AI 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.

Pull request overview

Copilot reviewed 48 out of 48 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/release/v1/util/resource_group.go Outdated
Comment thread pkg/kube/readiness.go
Comment thread pkg/kube/readiness.go
Comment thread pkg/cmd/template.go Outdated
Copilot AI review requested due to automatic review settings April 15, 2026 09:58

Copilot AI 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.

Pull request overview

Copilot reviewed 48 out of 48 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/cmd/rollback.go
Copilot AI review requested due to automatic review settings April 15, 2026 10:06

Copilot AI 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.

Pull request overview

Copilot reviewed 48 out of 48 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/action/rollback.go

Copilot AI 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.

Pull request overview

Copilot reviewed 59 out of 59 changed files in this pull request and generated 2 comments.

Comment thread pkg/chart/v2/util/subchart_dag.go Outdated
Comment thread pkg/chart/v2/dependency.go
caretak3r added a commit to caretak3r/helm that referenced this pull request Jun 26, 2026
Dependency.Validate() sanitized Name/Version/Repository/Condition/Tags but
not the HIP-0025 DependsOn field, whose entries are used verbatim as subchart
lookup keys when building the sequencing DAG. Stray control characters or
embedded whitespace could therefore cause spurious "unknown or disabled
subchart" failures. Sanitize DependsOn entries like the sibling fields.

Addresses a Copilot review comment on PR helm#32038.

Signed-off-by: Rohit Gudi <50377477+caretak3r@users.noreply.github.com>
caretak3r added a commit to caretak3r/helm that referenced this pull request Jun 26, 2026
The depends-on field is documented as accepting subchart names or aliases,
but BuildSubchartDAG only registered each subchart under its effective name
(alias if set), so referencing an aliased subchart by its original name was
rejected as "unknown or disabled subchart". Resolve references by either the
effective name or the original name, and reject a reference that maps to more
than one subchart as ambiguous rather than silently picking one.

Addresses a Copilot review comment on PR helm#32038.

Signed-off-by: Rohit Gudi <50377477+caretak3r@users.noreply.github.com>
@caretak3r

Copy link
Copy Markdown
Author

@joejulian Any suggestions? I can re-submit the PR in small pieces, one for each DAG?

Copilot AI review requested due to automatic review settings July 6, 2026 20:28
@caretak3r

Copy link
Copy Markdown
Author

Rebased onto current upstream/main and reworked this PR into a clean, layer-by-layer
commit stack. Every commit builds and tests green on its own (git rebase upstream/main --exec 'go build ./... && go test ./...'), so it can be reviewed — or split into a
stack of PRs — one layer at a time:

# Commit Scope
1 feat(hip-0025): add sequencing DAG and Chart.yaml depends-on schema generic DAG, subchart DAG, depends-on schema
2 feat(hip-0025): add resource-group parsing and release sequencing metadata resource-group parsing, Sequenced release flag
3 feat(hip-0025): add kstatus and custom JSONPath readiness engine kstatus + JSONPath readiness, custom status reader
4 feat(hip-0025): add sequencing lint rules cycle / orphan / partial-readiness lint
5 feat(hip-0025): sequence install, upgrade, rollback, and uninstall the SequencePlan executor + hooks
6 feat(hip-0025): add ordered wait CLI flags, template output, and dag command --wait=ordered, --readiness-timeout, ordered helm template, helm dag

What changed since your review

  • All review threads addressed. Your three CHANGES_REQUESTED items (subchart DAG
    built from post-ProcessDependencies state, uniform ctx cancellation, the
    cancellation test) are in, and the last open Copilot thread (nil-client
    fast-fail in validate.go) is fixed with a regression test.
  • Architecture pass — one walker. The two-level DAG walk that had been duplicated
    across install/uninstall/template/dag now lives in a single pure
    pkg/release/v1/sequence.Build; the forked sequenced-action pipelines are gone.
    Release metadata is a single Sequenced bool (with legacy decode).
  • Scope trimmed. Dropped the unrelated --post-render-strategy CLI flag and
    incidental churn that had crept in.
  • Two bugs found by end-to-end testing and fixed here:
    • Sequenced uninstall/rollback failed for any release read from a real storage
      driver — the release codec drops the chart's unexported loaded-dependency tree,
      so BuildSubchartDAG saw no subcharts. Now the DAG trusts the pruned,
      alias-resolved Metadata.Dependencies, with a structural # Source: fallback,
      and a plan-build failure degrades to unsequenced deletion instead of stranding
      the release in uninstalling.
    • Hook resources carrying helm.sh/depends-on/resource-groups (a multi-slash key
      K8s rejects) failed to apply under --wait=ordered; they're now stripped before
      apply, per the HIP's "annotations on hooks are ignored".

Testing

Beyond unit coverage, I ran a live matrix against a kind cluster: 35 capability rows
(ordered install/upgrade/rollback/uninstall, readiness success/failure/timeout,
subchart + resource-group DAGs, lint rules, backwards-compat against upstream
bitnami/postgresql, helm dag, SDK WaitStrategy) plus a 28-scenario end-to-end
lifecycle suite — all green on this branch.

Open questions for maintainers

  1. Chart v2 vs v3 gating. The HIP targets Chart v3; this implements against v2 but
    is entirely opt-in behind --wait=ordered, so no v2 chart changes behavior. Happy
    to gate it to a v3 apiVersion if you'd prefer.
  2. Annotation keys. helm.sh/depends-on/resource-groups and
    helm.sh/depends-on/subcharts are multi-slash and thus not valid Kubernetes
    annotation keys, which forces Helm to strip them before apply. Flagging in case the
    HIP wants to revise the chosen keys.
  3. Split? Happy to land this as the single well-layered PR here, or break it into
    the 6-PR stack above — your call.

Re-requesting review.

@caretak3r

Copy link
Copy Markdown
Author

@joejulian when you have a chance — this is rebased, re-layered, and your review items are all addressed (details above). Would appreciate another look, and happy to split it into the per-layer stack if that's easier to review.

Copilot AI 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.

Pull request overview

Copilot reviewed 77 out of 77 changed files in this pull request and generated 2 comments.

Comment thread pkg/cmd/dag.go
Comment thread pkg/action/sequencing.go
caretak3r added a commit to caretak3r/helm that referenced this pull request Jul 7, 2026
…ion keys

Address Copilot review on PR helm#32038:
- dag.go: printChild returned early for subcharts whose chart metadata is
  unavailable (storage-decoded charts at rollback/uninstall), hiding the
  structural resource-group batches buildStructuralLevel generates. Print
  an accurate note and still recurse into the structural child level. The
  old 'not found in chart dependencies' message was also misleading.
- sequencing.go: hoist HelmInternalSequencingAnnotations() out of the
  per-resource Visit closure so the slice is cloned once per batch.
caretak3r added a commit to caretak3r/helm that referenced this pull request Jul 8, 2026
…ion keys

Address Copilot review on PR helm#32038:
- dag.go: printChild returned early for subcharts whose chart metadata is
  unavailable (storage-decoded charts at rollback/uninstall), hiding the
  structural resource-group batches buildStructuralLevel generates. Print
  an accurate note and still recurse into the structural child level. The
  old 'not found in chart dependencies' message was also misleading.
- sequencing.go: hoist HelmInternalSequencingAnnotations() out of the
  per-resource Visit closure so the slice is cloned once per batch.
Copilot AI review requested due to automatic review settings July 8, 2026 13:28

Copilot AI 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.

Pull request overview

Copilot reviewed 77 out of 77 changed files in this pull request and generated 1 comment.

Comment on lines +254 to +259
annotations := manifest.Head.Metadata.Annotations
_, hasSuccess := annotations[releaseutil.AnnotationReadinessSuccess]
_, hasFailure := annotations[releaseutil.AnnotationReadinessFailure]
if hasSuccess != hasFailure {
b.warnf(WarningKindPartialReadiness, chartPath, "resource %q has only one of %s and %s; falling back to kstatus readiness", manifest.Head.Metadata.Name, releaseutil.AnnotationReadinessSuccess, releaseutil.AnnotationReadinessFailure)
}
caretak3r added 7 commits July 8, 2026 20:23
Generic DAG with deterministic topological batching and cycle detection,
the subchart dependency DAG builder (reading depends-on field and the
helm.sh/depends-on/subcharts annotation against post-processed
c.Dependencies() state), and the new depends-on field on Chart.yaml
dependency entries.

Refs: HIP-0025
Signed-off-by: Rohit Gudi <50377477+caretak3r@users.noreply.github.com>
…adata

Resource-group annotation parsing into a DAG, the SequencingInfo field
recorded on releases for sequenced uninstall/rollback, and the
helm-internal annotation stripping helper. Backward-compatible JSON
round-trip for releases stored without SequencingInfo.

Refs: HIP-0025
Signed-off-by: Rohit Gudi <50377477+caretak3r@users.noreply.github.com>
OrderedWaitStrategy, custom readiness evaluation via .status-scoped
JSONPath expressions (helm.sh/readiness-success / -failure), and the
status reader that layers custom readiness over kstatus.

Refs: HIP-0025
Signed-off-by: Rohit Gudi <50377477+caretak3r@users.noreply.github.com>
Lint validation for subchart and resource-group dependency cycles,
orphan group references, and the both-or-neither readiness annotation
rule.

Refs: HIP-0025
Signed-off-by: Rohit Gudi <50377477+caretak3r@users.noreply.github.com>
The sequenced deployment engine driving per-batch create-and-wait
across the resource-group and subchart DAGs, wired into install,
upgrade, rollback (respecting stored SequencingInfo), and reverse-order
uninstall. Default (non-ordered) paths are unchanged.

Refs: HIP-0025
Signed-off-by: Rohit Gudi <50377477+caretak3r@users.noreply.github.com>
…command

The --wait=ordered and --readiness-timeout flags across
install/upgrade/uninstall/rollback, ordered helm template output with
resource-group delimiters, and the helm dag debugging command.

Refs: HIP-0025
Signed-off-by: Rohit Gudi <50377477+caretak3r@users.noreply.github.com>
…ion keys

Address Copilot review on PR helm#32038:
- dag.go: printChild returned early for subcharts whose chart metadata is
  unavailable (storage-decoded charts at rollback/uninstall), hiding the
  structural resource-group batches buildStructuralLevel generates. Print
  an accurate note and still recurse into the structural child level. The
  old 'not found in chart dependencies' message was also misleading.
- sequencing.go: hoist HelmInternalSequencingAnnotations() out of the
  per-resource Visit closure so the slice is cloned once per batch.

Signed-off-by: Rohit Gudi <50377477+caretak3r@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 9, 2026 00:30

Copilot AI 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.

Pull request overview

Copilot reviewed 77 out of 77 changed files in this pull request and generated 2 comments.

Comment thread pkg/action/action.go
@@ -513,13 +520,13 @@ func (cfg *Configuration) renderResources(ctx context.Context, ch *chart.Chart,
// used by install or upgrade
err = writeToFile(newDir, m.Name, m.Content, fileWritten[m.Name])
Comment thread pkg/cmd/template.go
fileWritten[m.Path] = true
}

err = writeToFile(newDir, m.Path, m.Manifest, fileWritten[m.Path])
@caretak3r

Copy link
Copy Markdown
Author

Superseded by #32314, which contains the same changes rebased onto the latest main with a clean commit history. Closing this in favor of #32314.

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

Labels

size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants