community icon indicating copy to clipboard operation
community copied to clipboard

Cannot override "meta.helm.sh/release-name" ?

Open iamFrancescoFerro opened this issue 9 months ago • 0 comments

Hello,

We have a system that is able to deploy a PR. The release name is the name of the application + git hash eg: helm install my-api-HASH1 Each PR can be deploy and this allows us to have a full proper e2e before merging.

We also have one single shared namespace for the application. This is a nice way to have all the PRs into one namespace (easy to cleanup if needed), avoid resources pollution but most importantly allows us to for example automatically store secrets into one namespace vs (100 different Namespaces)

However we are facing an issue because Helm automatically adds this annotation: meta.helm.sh/release-name={chart's release-name}

This is causing an issue because it now makes the namespace non unique and we get this if we want to deploy a new PR helm install my-api-HASH2

Unable to continue with install: Namespace "mynamespace" in namespace "" exists and cannot be imported into the current release: invalid ownership metadata; annotation validation error: key "meta.helm.sh/release-name" must equal "my-api-HASH2": current value is "my-api-HASH1"

We have of course tried this adding this meta.helm.sh/release-name": "mynamespace" but this gets ignored by Helm.

Is there a way somehow to override that value ? Is there an other way that would allow us to keep one single namespace for multiple releases ?

UPDATE: Spent some time searching around and I read in the best practices that it was better to not specify the namespace: .. field on the resources and let helm handle it.

Indeed, if I remove the Namespace resource and remove all the namespace: .. field it works only if I passes --namespace XXX --create-namespace

However now I'd like to know if there is a way to add custom labels to the namespace Helm is creating?

Thank you!

iamFrancescoFerro avatar May 07 '24 07:05 iamFrancescoFerro