Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add label to existed namespace by helm

I have a project to create a mutating webhook in the kube-system namespace, which needs to exclude webhook server deployment namespaces.

But the kube-system namespace has been created. How do I attach the required labels to it using Helm?

like image 494
moluzhui Avatar asked Sep 19 '25 21:09

moluzhui


1 Answers

Helmfile offers hooks which are pretty neat for that:

releases:
- name: istio-ingress
  namespace: istio-ingress
  chart: istio/gateway
  wait: true
  hooks:
    - events:
        - presync
      showlogs: true
      command: sh
      args:
        - -c
        - "kubectl create namespace istio-ingress --dry-run=client -o yaml | kubectl apply -f -"
    - events:
        - presync
      showlogs: true
      command: sh
      args:
        - -c
        - "kubectl label --dry-run=client -o yaml --overwrite namespace istio-ingress istio-injection=enabled | kubectl apply -f -"
like image 83
zemicolon Avatar answered Sep 23 '25 11:09

zemicolon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!