-
Notifications
You must be signed in to change notification settings - Fork 7.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow install, update action to adopt existing resources (sdk only) #12876
Conversation
Allow the SDK actions to adopt existing resources. This allows install and update to overwrite resources. If TakeOwnership is not set, adoption is only possible if they existing resources have the right labels (managed-by) and annotations (release-name, ...). Signed-off-by: Mario Manno <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work @manno 👍
This could be a useful feature to bring into the CLI install and upgrade CLI commands too at some point.
golangci-lint passed when last commit was made on helm#12876, but has since failed. This is probably because the linter has since updated. I ran locally with the same version of golangci-lint we run in GH Actions, and this is the only error now (an additional linting error in pkg/action/package.go since helm#12876 has already been fixed. ```sh curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.58.1 ./bin/golangci-lint run pkg/action/... ./bin/golangci-lint run ./... ``` we should be good now. Signed-off-by: Scott Rigby <[email protected]>
The `TakeOwnership` setting was added to the install and upgrade actions in helm#12876 This PR allows setting this option on install and upgrade via the CLI using a --take-ownership flag Signed-off-by: Mayank Shah <[email protected]>
The `TakeOwnership` setting was added to the install and upgrade actions in helm#12876 This PR allows setting this option on install and upgrade via the CLI using a --take-ownership flag Signed-off-by: Mayank Shah <[email protected]>
@manno, thanks for implementing this feature! PR description:
Based on this i would assume that the existing resource should get overwritten/updated based on values and chart templates fused for the Helm relase, but it seems that it is not the case? As i understand with If i understand correctly then I'm wondering if there is a way to make helm actually update the existing resource (without removing and re-creating it) with new content instead of silently ignoring changes that should be applied based on values and chart templates? |
hi @manno, could you share your ideas/thoughts/insights about my question/comment? |
Yes, TakeOwnership only ignores the existing labels. Updating the resource is still handled by Helm as usual. This PR didn't change how Helm updates, it just allowed Helm to update existing resources. We found out that updating (three way merge) doesn't work for custom resources, see #13439 |
We use the Helm SDK in a GitOps operator and need more control over existing resources. We considered patching them with the Helm labels and annotations, but that would mean another update request per resource. Furthermore it seems wrong to apply Helm labels to resources, before the chart has actually been applied to them.
The PR introduces a new option
TakeOwnership
. IfTakeOwnership
is set, existing resources will be adopted, overwritten, etc. when installing or updating. Helm will not check for labels.If it is not set, Helm behaves like before: adoption is only possible if they existing resources have the right labels
(
managed-by
) and annotations (release-name
, ...).