From f826622e9c69502a64ee9f0c535cab9b5bf053cc Mon Sep 17 00:00:00 2001 From: isbakurskii Date: Tue, 29 Oct 2024 22:50:50 +0100 Subject: [PATCH] Added namespacedScope value to the helm chart --- ytop-chart/templates/deployment.yaml | 4 +++- .../validating-webhook-configuration.yaml | 15 +++++++++++++++ ytop-chart/values.yaml | 1 + 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/ytop-chart/templates/deployment.yaml b/ytop-chart/templates/deployment.yaml index 3af17a29..eafe9cfa 100644 --- a/ytop-chart/templates/deployment.yaml +++ b/ytop-chart/templates/deployment.yaml @@ -28,8 +28,10 @@ spec: env: - name: YT_LOG_LEVEL value: {{ quote .Values.controllerManager.manager.env.ytLogLevel }} + {{- if .Values.controllerManager.manager.namespacedScope }} - name: WATCH_NAMESPACE - value: {{ quote .Values.controllerManager.manager.env.watchNamespace }} + value: {{ tpl (.Release.Namespace) $ }} + {{- end }} - name: KUBERNETES_CLUSTER_DOMAIN value: {{ quote .Values.kubernetesClusterDomain }} image: {{ .Values.controllerManager.manager.image.repository }}:{{ .Values.controllerManager.manager.image.tag diff --git a/ytop-chart/templates/validating-webhook-configuration.yaml b/ytop-chart/templates/validating-webhook-configuration.yaml index c27f0770..50938f69 100644 --- a/ytop-chart/templates/validating-webhook-configuration.yaml +++ b/ytop-chart/templates/validating-webhook-configuration.yaml @@ -16,6 +16,11 @@ webhooks: path: /validate-cluster-ytsaurus-tech-v1-chyt failurePolicy: Fail name: vchyt.kb.io + {{- if .Values.controllerManager.manager.namespacedScope }} + namespaceSelector: + matchLabels: + kubernetes.io/metadata.name: {{ .Release.Namespace }} + {{- end }} rules: - apiGroups: - cluster.ytsaurus.tech @@ -36,6 +41,11 @@ webhooks: path: /validate-cluster-ytsaurus-tech-v1-spyt failurePolicy: Fail name: vspyt.kb.io + {{- if .Values.controllerManager.manager.namespacedScope }} + namespaceSelector: + matchLabels: + kubernetes.io/metadata.name: {{ .Release.Namespace }} + {{- end }} rules: - apiGroups: - cluster.ytsaurus.tech @@ -56,6 +66,11 @@ webhooks: path: /validate-cluster-ytsaurus-tech-v1-ytsaurus failurePolicy: Fail name: vytsaurus.kb.io + {{- if .Values.controllerManager.manager.namespacedScope }} + namespaceSelector: + matchLabels: + kubernetes.io/metadata.name: {{ .Release.Namespace }} + {{- end }} rules: - apiGroups: - cluster.ytsaurus.tech diff --git a/ytop-chart/values.yaml b/ytop-chart/values.yaml index fa46be89..09321e8e 100644 --- a/ytop-chart/values.yaml +++ b/ytop-chart/values.yaml @@ -23,6 +23,7 @@ controllerManager: cpu: 5m memory: 64Mi manager: + namespacedScope: false args: - --health-probe-bind-address=:8081 - --metrics-bind-address=127.0.0.1:8080