Error: "cannot re-use a name that is still in use"
zchenyu opened this issue · comments
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:
Line 784 in 43db5e2
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: #162