diff --git a/charts/stable/pod-gateway/templates/webhook-admissionregistration.yaml b/charts/stable/pod-gateway/templates/webhook-admissionregistration.yaml index a038de5b..ff738384 100644 --- a/charts/stable/pod-gateway/templates/webhook-admissionregistration.yaml +++ b/charts/stable/pod-gateway/templates/webhook-admissionregistration.yaml @@ -10,7 +10,12 @@ webhooks: - name: "{{ include "common.names.fullname" . }}.svc.cluster.local" namespaceSelector: {{- with .Values.webhook.namespaceSelector }} - {{ toYaml . | nindent 4 }} + {{- if eq .type "label" }} + matchLabels: + {{ .label }}: "true" + {{- else if eq .type "custom" }} + {{- toYaml .custom | nindent 4 }} + {{- end }} {{- end }} rules: - apiGroups: [""] diff --git a/charts/stable/pod-gateway/values.yaml b/charts/stable/pod-gateway/values.yaml index 42e1bad7..0006d9c2 100644 --- a/charts/stable/pod-gateway/values.yaml +++ b/charts/stable/pod-gateway/values.yaml @@ -119,12 +119,13 @@ webhook: # **IMPORTANT**: Do not select the namespace where the webhook # is deployed to or you will get locking issues. namespaceSelector: - matchLabels: - routed-gateway: "true" - # matchExpressions: - # - key: notTouch - # operator: NotIn - # values: ["1"] + type: label + label: "routed-gateway" + custom: {} + # matchExpressions: + # - key: notTouch + # operator: NotIn + # values: ["1"] # -- default behviour for new PODs in the evaluated namespace gatewayDefault: true