helm-charts icon indicating copy to clipboard operation
helm-charts copied to clipboard

Add Namesapces to Chart

Open foertel opened this issue 1 year ago • 4 comments

Preflight Checklist

  • [X] I agree to follow the Code of Conduct that this project adheres to.
  • [X] I have searched the issue tracker for an issue that matches the one I want to file, without success.

Problem Description

The objects generated by Helm do not wear a Namespace. There is no way to specify one, as Helm's namespace argument is pretty inconsistent.

Proposed Solution

Add Namespace-properties to all object's yaml wrapped in a condition. This would give the opportunity to set the namespace using Values and would otherwise not affect at all.

Alternatives Considered

Export objects with helm template and specify -n on kubectl. Does not really go with most GitOps flows.

Additional Information

No response

foertel avatar Sep 11 '23 07:09 foertel

If anyone would give a thumbs up on the idea, I'd happily provide an MR.

Helm also suggests to do it this way, if you wanna use namespaces. https://github.com/helm/helm/issues/3553

foertel avatar Sep 11 '23 07:09 foertel

What's the added value of adding namespaces to the resources? From what I can tell, most GitOps tools can already deploy to namespaces.

sagikazarmark avatar Sep 11 '23 18:09 sagikazarmark

When using GitOps tools many of us use helm template to render the chart(*) and thus need to specify the namespace anyway, because otherwise the selectors (like RoleBinding) will be broken. But then we'd end up with manifests, that point selectors to one namespace but still can be deployed to another. We basically have to keep the namespace configuration in two different locations.

It feels inconsistent to have namespaces in part of the manifests but not others.

(*) Many of us even render the manifests first and commit them for review to have a better understanding of what's going to happen in CI.

foertel avatar Sep 12 '23 10:09 foertel

Many users (including me) complain about the missing namespace in helm template. Having helm install --namespace and helm template --namespace behaving differently seems wrong.

https://github.com/helm/helm/issues/3553

jbertozzi avatar Dec 01 '23 08:12 jbertozzi