Skip to content

Add metadata to created namespace #3503

Closed

Description

@sathieu
No description provided.

Activity

  1. sathieu commented on Feb 13, 2018

    @sathieu
    ContributorAuthor

    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
  2. faheem-nadeem commented on Jun 4, 2018

    @faheem-nadeem

    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.

  3. munnerz commented on Jun 16, 2018

    @munnerz
    Contributor

    +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.

  4. sudermanjr commented on Jun 26, 2018

    @sudermanjr

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

  5. kvudata commented on Jun 27, 2018

    @kvudata

    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.

  6. sudermanjr commented on Sep 5, 2018

    @sudermanjr

    @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 ?

  7. munnerz commented on Sep 6, 2018

    @munnerz
    Contributor

    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.

  8. kvudata commented on Sep 6, 2018

    @kvudata

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

  9. jordan-da commented on Oct 11, 2018

    @jordan-da

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

  10. sudermanjr commented on Oct 11, 2018

    @sudermanjr

    @jordan-da See the gist from kvudata above.

  11. jordan-da commented on Oct 11, 2018

    @jordan-da

    @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.

  12. AlexShemeshWix commented on Jan 24, 2019

    @AlexShemeshWix

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

  13. victornoel commented on Apr 4, 2019

    @victornoel

    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…

  14. sudermanjr commented on Apr 4, 2019

    @sudermanjr

    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)

  15. rbq commented on May 28, 2019

    @rbq

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

  16. bacongobbler commented on Oct 12, 2019

    @bacongobbler
    Member

    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!

  17. gofman8 commented on Sep 22, 2020

    @gofman8

    Hi all! Please reopen due to #7648

  18. bacongobbler commented on Sep 22, 2020

    @bacongobbler
    Member

    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.

  19. added a commit that references this issue on Jul 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions