From fb898031b486aa96d5c646788f295e17cd8ced98 Mon Sep 17 00:00:00 2001 From: Toboshii Nakama Date: Mon, 2 Aug 2021 15:58:48 -0500 Subject: [PATCH] fix: allow custom selectors without dict merges --- .../templates/webhook-admissionregistration.yaml | 7 ++++++- charts/stable/pod-gateway/values.yaml | 13 +++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) 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