Add --take-ownership flag for install and upgrade commands#13439
Add --take-ownership flag for install and upgrade commands#13439scottrigby merged 6 commits intohelm:mainfrom
Conversation
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 <mayankshah1614@gmail.com>
gjenkins8
left a comment
There was a problem hiding this comment.
very minor fix up of the help text please
Co-authored-by: George Jenkins <gvjenkins@gmail.com> Signed-off-by: Mayank Shah <mayankshah1614@gmail.com>
Co-authored-by: George Jenkins <gvjenkins@gmail.com> Signed-off-by: Mayank Shah <mayankshah1614@gmail.com>
|
@scottrigby / @joejulian are you able to take a look at this one? |
|
@mayankshah1607 since this PR needs to merged into v3, can you please create a new PR to dev-v3 branch with the same changes here? |
scottrigby
left a comment
There was a problem hiding this comment.
This PR looks good, however with manual testing this doesn't seem to be working for upgrade, only install. I'm not sure why this would be the case, since it should work according to #12876
Can someone else reproduce this?
# create example chart
helm create foo
# create matching plain template files
helm template foo foo --output-dir foo-template
<remove all helm labels>
<remove tests dir>
# install plan manifests without helm labels or metadata
kubectl apply -f foo-template/foo/templates/
# it makes sense that this wouldn't work
$ helm upgrade foo foo/ --take-ownership
Error: UPGRADE FAILED: "foo" has no deployed releases
# from this PR it seems this should work, but doesn't
$ helm upgrade --install foo foo/ --take-ownership
Error: Unable to continue with install: ServiceAccount "foo" in namespace "default" exists and cannot be imported into the current release: invalid ownership metadata; label validation error: missing key "app.kubernetes.io/managed-by": must be set to "Helm"; annotation validation error: missing key "meta.helm.sh/release-name": must be set to "foo"; annotation validation error: missing key "meta.helm.sh/release-namespace": must be set to "default"
# this works
$ helm install foo foo/ --take-ownership
<expected output>
$ helm ls
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
foo default 1 2024-12-11 00:21:59.727628 -0500 EST deployed foo-0.1.0 1.16.0 PS I'm also updating the description to point to the correct PR (#12876 not #13130), and adding closing keywords to related issues (#10304 and #2730).
scottrigby
left a comment
There was a problem hiding this comment.
For upgrade --install to work, we also need to add this:
diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go
index 1fe793a92..75788459b 100644
--- a/cmd/helm/upgrade.go
+++ b/cmd/helm/upgrade.go
@@ -151,6 +151,7 @@ func newUpgradeCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
instClient.Labels = client.Labels
instClient.EnableDNS = client.EnableDNS
instClient.HideSecret = client.HideSecret
+ instClient.TakeOwnership = client.TakeOwnership
if isReleaseUninstalled(versions) {
instClient.Replace = trueSigned-off-by: Mayank Shah <mayankshah1614@gmail.com>
|
Thanks @scottrigby , I've updated the PR |
@banjoh can I just change the base of this PR? Or does it need to be created against both |
You'll need 2 separate PRs. Changing the PR base will mean your changes go to one branch and not the other. |
|
Running the tests locally, everything seems to pass. I'm not sure what the issue is, but I pushed a fix anyway.. not sure if that'll do. |
Signed-off-by: Mayank Shah <mayankshah1614@gmail.com>
|
Ok, tests are fixed. PR against |
scottrigby
left a comment
There was a problem hiding this comment.
@mayankshah1607 test fix looks good. Nice work 👏
|
@yxxhero take a look at this. Helmfile would greatly benefit from it. |
ok got it |
|
if i understand correctly, then official documentation isn't currently updated with this new flag? Seems just the feature i was looking for - very good timing regarding the release of this feature :) |
**Description** As discussed in this slack thread: https://envoyproxy.slack.com/archives/C07Q4N24VAA/p1761235915409479, we want to separate the crd chart and the resources chart. (option 1 of the proposed approaches in #1186) **Related Issues/PRs (if applicable)** #1186 **Special notes for reviewers (if applicable)** Added an extra note on upgrade when done from a previous install of ai-gateway-helm helm chart alone. it uses the `--take-ownership` flag while upgrading: helm/helm#13439, https://helm.sh/docs/helm/helm_upgrade/#options Open Question: - Should we rename `ai-gateway-helm` to `ai-gateway-resources-helm`? It would be more consistent but upgrade is slightly trickier cc: @mathetake @johnugeorge @nagar-ajay Signed-off-by: sailesh duddupudi <saileshradar@gmail.com>
…1431) **Description** As discussed in this slack thread: https://envoyproxy.slack.com/archives/C07Q4N24VAA/p1761235915409479, we want to separate the crd chart and the resources chart. (option 1 of the proposed approaches in envoyproxy#1186) **Related Issues/PRs (if applicable)** envoyproxy#1186 **Special notes for reviewers (if applicable)** Added an extra note on upgrade when done from a previous install of ai-gateway-helm helm chart alone. it uses the `--take-ownership` flag while upgrading: helm/helm#13439, https://helm.sh/docs/helm/helm_upgrade/#options Open Question: - Should we rename `ai-gateway-helm` to `ai-gateway-resources-helm`? It would be more consistent but upgrade is slightly trickier cc: @mathetake @johnugeorge @nagar-ajay Signed-off-by: sailesh duddupudi <saileshradar@gmail.com> Signed-off-by: Erica Hughberg <erica.sundberg.90@gmail.com>
closes #10304, closes #2730
What this PR does / why we need it:
TakeOwnershipoption was added to the Install and Upgrade actions in #12876. This PR allows setting this option on the CLI commands using a new--take-ownershipflagSpecial notes for your reviewer:
xref: #10304 (comment)
If applicable:
docs neededlabel should be applied if so)