Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add metadata to created namespace #3503

Closed
sathieu opened this issue Feb 13, 2018 · 18 comments
Closed

Add metadata to created namespace #3503

sathieu opened this issue Feb 13, 2018 · 18 comments
Labels

Comments

@sathieu
Copy link
Contributor

sathieu commented Feb 13, 2018

No description provided.

@sathieu
Copy link
Contributor Author

sathieu commented Feb 13, 2018

Currently createNamespace doesn't set any metadata. Please add the following:

apiVersion: v1
kind: namespace
metadata:
  name: foo
  labels:
    app: HERE
    chart: HERE
    heritage: Tiller
    release: HERE

@faheem-nadeem
Copy link

I wish to add custom labels to namespaces, or maybe the default best practices one will suffice as well. Currently don't know of a way to do it with namespace being created by helm automatically i.e. using --namespace. Nor I believe I can add a namespace manifest like here to helm charts. My use-case is this: prometheus-operator/prometheus-operator#1331 (comment). Whereby namespaces are being selected using LabelSelector and we are unable to because of missing labels on namespaces.

@munnerz
Copy link
Contributor

munnerz commented Jun 16, 2018

+1 to this. I want to use a ValidatingWebhookConfiguration and need to exclude validation on the namespace the release is deployed into for bootstrapping purposes.

The namespaceSelector only supports selecting based on labels, so I need to somehow label the release namespace.

Happy to put in the work for this if someone can confirm it's an acceptable request/how it should be done.

@sudermanjr
Copy link

Custom labels will be very helpful for labelling namespaces for istio sidecar injection using the mutating webhook admission controller as well.

@kvudata
Copy link

kvudata commented Jun 27, 2018

I had the same issue, I was able to get things to work using a chart pre-install hook e.g. https://gist.github.com/kvudata/12ba57ae1e7f01799aaa7f36350a9b2e.

@sudermanjr
Copy link

@kvudata Does that work if the namespace is being created by helm, or only if the namespace already exists when you run the helm install ?

@munnerz
Copy link
Contributor

munnerz commented Sep 6, 2018

Since #4231 is merged, it is now possible to do this sort of thing (from Helm 2.10 onwards) - provided that the namespace does not already exist when the user first runs helm install.

@kvudata
Copy link

kvudata commented Sep 6, 2018

@sudermanjr, when I tested it worked in both scenarios (whether the namespace exists already or not).

@jordan-da
Copy link

Is there a way to add your own labels to a namespace helm is creating for you?

@sudermanjr
Copy link

@jordan-da See the gist from kvudata above.

@jordan-da
Copy link

@sudermanjr yea, I saw it (and commented on it).. I am just so surprised! Seems like a worthy one off thing to have.

I ended up creating my namespace before running helm, with the labels I required. Speaking of one offs.

@AlexShemeshWix
Copy link

Im voting up this one.
Any plans to implement? The solution from gist is complicated.

@victornoel
Copy link

It's a workaround, but using helmfile allows you to define hooks that are executed before a chart is deployed, see for example roboll/helmfile#538 for the use case defined here…

@sudermanjr
Copy link

Another workaround would be to use Reckoner hooks as well.

https://github.com/reactiveops/reckoner#hooks

(Full disclosure, I work for the company that wrote Reckoner)

@rbq
Copy link

rbq commented May 28, 2019

I'm currently trying to work around this issue by deploying Namespaces via magic namespace chart (with Tiller and Service Accounts disabled).

@bacongobbler
Copy link
Member

bacongobbler commented Oct 12, 2019

Closing as a wontfix. The namespace creation code was removed from Helm 3 to align with Kubernetes best practices. See #5753 (comment) for a more detailed explanation. Thanks!

@gofman8
Copy link

gofman8 commented Sep 22, 2020

Hi all! Please reopen due to #7648

@bacongobbler
Copy link
Member

bacongobbler commented Sep 22, 2020

We re-introduced —create-namespace with the caveat that we will not be planning to support this use case due to the complexity of manipulating the namespace.

If you want to apply custom labels or annotations to the namespace, please use kubectl create namespace or some other method instead.

zacharyblasczyk added a commit to wandb/helm-charts that referenced this issue Jul 11, 2023
* Namespace should be created with --create-namespace per helm/helm#3503
* Fixed some SA bugs to work with Terraform wrapper.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests