Error: "cannot re-use a name that is still in use"
I'm using
_, err := client.InstallOrUpgradeChart(ctx, &helmclient.ChartSpec{
ReleaseName: chart.releaseName,
Namespace: chart.namespace,
Version: chart.version,
ChartName: chart.chartName,
})
to install or upgrade a chart to a new version, but am getting this error: "cannot re-use a name that is still in use"
I thought this function would upgrade the chart if the release already exists. Is there some other function or parameter that I should be using to make it upgrade if there's a newer version and the release already exists?
Okay I think I found the issue: https://github.com/mittwald/go-helm-client/blob/43db5e2a1d107a2e3a845ad228b8a14824f8cc32/client.go#L784
If Namespace is not set in ChartSpec to default to the "default" namespace, this equality will fail. I think we need to update this function to account for that.
The workaround is to always explicitly set Namespace in ChartSpec.
Actually, this doesn't work 100% of the time since sometimes r.Namespace is "default" and sometimes it's "". I think it might depend on how the chart was installed.
PR with fix: https://github.com/mittwald/go-helm-client/pull/162