feat(action): return rendered resources from ReleaseInstall - #718
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
action.ReleaseInstallnow returnsReleaseInstallResultV1instead of only an error, so libraryconsumers get the release identity, its status and the resources of the release without re-rendering
the chart.
Key changes
ReleaseInstallResultV1withAPIVersion,Release(name, namespace, revision, status) andResourcesas[]*spec.ResourceSpec— same shape asChartRenderResultV2, so render and installresults are handled by the same consumer code.
annotations, taken from
InstallableResourceInfo.LocalResource.ResourceSpec, sorted byResourceSpecSortHandlerand deduplicated (there is one info per deploy stage, so amulti-stage hook like
helm.sh/hook: pre-install,post-installwould otherwise appear twice).already-up-to-date path (revision of the release that stays in the cluster, status
skipped) andthe 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.
releaseReportV3andInstallReportPathare untouched.Verification
task test:unitwithtags=ai_tests, including new unit tests for sorting, dedup of multi-stageresources and preserved
ResourceSpecdata.ReleaseInstallitself was not performed — there is no cluster-level testinfrastructure in
pkg/action.Review focus / risks
action.ReleaseInstall: it returns(*ReleaseInstallResultV1, error)now.The only in-repo caller (
cmd/nelm/release_install.go) discards the result, matchingChartRender/ReleaseGet.Resourcesincludes resources withMustInstall == none(unchanged ones) — this is the resourceset of the release, not the set of objects actually sent to the API server.