Repository navigation
Description
Bug description
helm install foo (example chart is below) with dependency for chart bar then upgrade it with golang GetRelease upgrade release (golang pseudo-code example in the end) results in deleting all dep manifests.
The reason behind the bug is that dependencies are not saved in release meta data (by design to save space as etcd key value limits objects size).
However, this is a real non-intuitive behaviour, the expected behaviour should result in leaving the chart as it is (maybe add a param to action.Upgrade to skip dependencies objects?). Hopefully there is a way to identify these manifests it without exceeding the 1MB limit .
Actual behaviour
Something like (assuming release foo in the example below is already installed) :
getRelease := action.NewGet(cfg)
res, err := getRelease.Run(e.release)
upgrade := action.NewUpgrade(cfg)
res, err := upgrade.Run(
res.Name,
res.Chart,
res.Config)
will result in:
2020/07/18 12:32:12 preparing upgrade for foo
2020/07/18 12:32:13 performing update for foo
2020/07/18 12:32:13 creating upgraded release for foo
2020/07/18 12:32:13 checking 3 resources for changes
2020/07/18 12:32:13 Looks like there are no changes for ServiceAccount "foo"
2020/07/18 12:32:13 Looks like there are no changes for Service "foo"
2020/07/18 12:32:13 Looks like there are no changes for Deployment "foo"
2020/07/18 12:32:13 Deleting "foo-bar" in default...
2020/07/18 12:32:13 Deleting "foo-bar" in default...
2020/07/18 12:32:13 Deleting "foo-bar" in default...
2020/07/18 12:32:13 Deleting "foo-bar-test-connection" in default...
2020/07/18 12:32:13 Deleting "foo-test-connection" in default...
2020/07/18 12:32:13 updating status for upgraded release for foo
Example chart
helm create foo
cd foo/charts
helm create bar
helm install foo ..
Helm/Kubectl versions
Output of helm version:
version.BuildInfo{Version:"v3.2.4", GitCommit:"0ad800ef43d3b826f31a5ad8dfbb4fe05d143688", GitTreeState:"clean", GoVersion:"go1.13.12"}
(checked also with 3.3.0-rc1)
Output of kubectl version:
kubectl version
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.6", GitCommit:"dff82dc0de47299ab66c83c626e08b245ab19037", GitTreeState:"clean", BuildDate:"2020-07-15T16:58:53Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.2", GitCommit:"52c56ce7a8272c798dbc29846288d7cd9fbae032", GitTreeState:"clean", BuildDate:"2020-04-30T20:19:45Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}
Update (mattfarina): added code blocks for formatting.
Activity
[-]Helm upgrade release with dependecies results in removing dependecies[/-][+]Helm upgrade release with dependecies from getRelease metadata results in removing dependecies[/+]mattfarina commentedon Jul 20, 2020
@nirroz93 if I understand it right... you're trying to get the chart off the release and then use that for upgrades.
I wonder how this impacts rollback. There are some possible bugs in here.
nirroz93 commentedon Jul 21, 2020
@mattfarina You understand correctly.
I don't understand how this would impact the rollback (rollback is done base on the manifests that are saved per version, isn't it?).
bacongobbler commentedon Jul 21, 2020
I'm not sure if this is something we plan to support given the same reasons stated earlier. How would you propose we could support this use case?
@mattfarina this would not affect
helm rollback-helm upgradesaves all rendered manifests in the chart release metadata. We just don't save extra information like the pre-rendered templates necessary for a use case like this one.nirroz93 commentedon Jul 21, 2020
I don't really know/understand how the release metadata is saved (I need to drill down more to understand it), but in helm get manifest the output has "# Source: " prefix, and get manifest includes the sub-chart manifests. So from this I guessed that the manifests metadata includes the original template file path (and therefore it shouldn't be hard to get subcharts objects from the current release and add them to a
blacklistdeny list in upgrade).Another option is to use helm.sh/chart label (if it exists).
bacongobbler commentedon Jul 21, 2020
helm get manifestdisplays the manifests, post-render. Those are saved in the release object, and those are the same manifests used duringhelm rollback. We just don't include the pre-rendered templates as there's no need for them after the manifests have been rendered - we only need the post-rendered manifests to helphelm rollbackrevert back to that release's state. We don't need the templates afterhelm upgradeas we're never re-rendering those templates again.Hope that helps clarify things.
nirroz93 commentedon Jul 21, 2020
Yes, but I dont suggest to re-template them. I just want the objects to stay as they are (don't delete them)
bacongobbler commentedon Jul 22, 2020
I’m confused... What you’re describing is how
helm rollbackworks. If you’re re-using the post-rendered manifests to perform an “upgrade”, you’re performing a rollback. A rollback is effectively an upgrade to a previously known state. It even bumps the release version when you invoke it.How would your use case differ from just calling
helm rollbackinstead?nirroz93 commentedon Jul 22, 2020
My case is just using upgrade. I simplified it to a "rollback" with upgrade demonstrate the problem, so the code above really really a weird rollback but lets say that I want to upgrade the current release values (not touching values related to "bar" release) - Currently the only option is to have bar release on local.
Upgrade should do the same as rollback in this case (or at least should have a flag to do it same as rollback) - not deleting the release dependencies.
github-actions commentedon Oct 21, 2020
This issue has been marked as stale because it has been open for 90 days with no activity. This thread will be automatically closed in 30 days if no further activity occurs.