Skip to content

feat(action): return rendered resources from ReleaseInstall - #718

Merged
dmmordvi merged 2 commits into
mainfrom
feat/return-resources-from-release-install
Sep 18, 2026
Merged

dmmordvi merged 2 commits into
mainfrom
feat/return-resources-from-release-install

Conversation

@dmmordvi

@dmmordvi dmmordvi commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Summary

action.ReleaseInstall now returns ReleaseInstallResultV1 instead of only an error, so library
consumers get the release identity, its status and the resources of the release without re-rendering
the chart.

Key changes

  • New ReleaseInstallResultV1 with APIVersion, Release (name, namespace, revision, status) and
    Resources as []*spec.ResourceSpec — same shape as ChartRenderResultV2, so render and install
    results are handled by the same consumer code.
  • Resources are the ones rendered and patched for this deploy, including release metadata
    annotations, taken from InstallableResourceInfo.LocalResource.ResourceSpec, sorted by
    ResourceSpecSortHandler and deduplicated (there is one info per deploy stage, so a
    multi-stage hook like helm.sh/hook: pre-install,post-install would otherwise appear twice).
  • The result is returned unless the release failed with critical errors — including the
    already-up-to-date path (revision of the release that stays in the cluster, status skipped) and
    the path with non-critical errors.

Why

Controllers embedding nelm as a library (deckhouse and similar) need to know what exactly was
deployed. Today they either re-render the chart or parse the release afterwards; both can diverge
from what the install actually used.

releaseReportV3 and InstallReportPath are untouched.

Verification

  • task test:unit with tags=ai_tests, including new unit tests for sorting, dedup of multi-stage
    resources and preserved ResourceSpec data.
  • A real-cluster run of ReleaseInstall itself was not performed — there is no cluster-level test
    infrastructure in pkg/action.

Review focus / risks

  • Signature change of the exported action.ReleaseInstall: it returns (*ReleaseInstallResultV1, error) now.
    The only in-repo caller (cmd/nelm/release_install.go) discards the result, matching ChartRender/ReleaseGet.
  • Resources includes resources with MustInstall == none (unchanged ones) — this is the resource
    set of the release, not the set of objects actually sent to the API server.

Review in cubic

ReleaseInstall now returns ReleaseInstallResultV1 with the release name,
namespace, revision, status and the release resources as they were rendered
and patched for this deploy, including release metadata annotations, taken
from InstallableResourceInfo.LocalResource.ResourceSpec. ResourceSpec is used
instead of a bare Unstructured to keep StoreAs and FilePath, and to match
ChartRenderResultV2, so consumers handle render and install results with the
same code. Resources are deduplicated, because there is one
InstallableResourceInfo per deploy stage and a resource may be deployed on
several stages.

The result is returned unless the release failed with critical errors: it is
also returned when the release was skipped as already up to date, with the
revision of the release that stays in the cluster and the skipped status, and
when non-critical errors are returned alongside it.

Signed-off-by: Dmitry Mordvinov <dmitry.mordvinov@flant.com>
Signed-off-by: Dmitry Mordvinov <dmitry.mordvinov@flant.com>

# Conflicts:
#	pkg/action/release_install.go
#	pkg/action/release_install_ai_test.go
@dmmordvi
dmmordvi marked this pull request as ready for review September 18, 2026 16:30
@dmmordvi
dmmordvi merged commit 312d2f2 into main Sep 18, 2026
8 checks passed
@dmmordvi
dmmordvi deleted the feat/return-resources-from-release-install branch September 18, 2026 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant