From 6e9d95fff679a7492dfa736ce559c14986f5d885 Mon Sep 17 00:00:00 2001 From: Jonathan Innis Date: Thu, 22 Aug 2024 15:53:20 -0700 Subject: [PATCH] chore: Alow service namespace override (#6849) --- .../templates/karpenter.k8s.aws_ec2nodeclasses.yaml | 2 +- charts/karpenter-crd/templates/karpenter.sh_nodeclaims.yaml | 2 +- charts/karpenter-crd/templates/karpenter.sh_nodepools.yaml | 2 +- charts/karpenter-crd/values.yaml | 1 + hack/mutation/conversion_webhook_injection.sh | 6 +++--- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/charts/karpenter-crd/templates/karpenter.k8s.aws_ec2nodeclasses.yaml b/charts/karpenter-crd/templates/karpenter.k8s.aws_ec2nodeclasses.yaml index eb7f8e913e99..90b3e5c064ad 100644 --- a/charts/karpenter-crd/templates/karpenter.k8s.aws_ec2nodeclasses.yaml +++ b/charts/karpenter-crd/templates/karpenter.k8s.aws_ec2nodeclasses.yaml @@ -1341,7 +1341,7 @@ spec: clientConfig: service: name: {{ .Values.webhook.serviceName }} - namespace: {{ .Release.Namespace }} + namespace: {{ .Values.webhook.serviceNamespace | default .Release.Namespace }} port: {{ .Values.webhook.port }} {{- end }} diff --git a/charts/karpenter-crd/templates/karpenter.sh_nodeclaims.yaml b/charts/karpenter-crd/templates/karpenter.sh_nodeclaims.yaml index 0f996e3355cb..57c3edcf21bd 100644 --- a/charts/karpenter-crd/templates/karpenter.sh_nodeclaims.yaml +++ b/charts/karpenter-crd/templates/karpenter.sh_nodeclaims.yaml @@ -839,7 +839,7 @@ spec: clientConfig: service: name: {{ .Values.webhook.serviceName }} - namespace: {{ .Release.Namespace }} + namespace: {{ .Values.webhook.serviceNamespace | default .Release.Namespace }} port: {{ .Values.webhook.port }} {{- end }} diff --git a/charts/karpenter-crd/templates/karpenter.sh_nodepools.yaml b/charts/karpenter-crd/templates/karpenter.sh_nodepools.yaml index 6f7d91263a89..5d9831079df5 100644 --- a/charts/karpenter-crd/templates/karpenter.sh_nodepools.yaml +++ b/charts/karpenter-crd/templates/karpenter.sh_nodepools.yaml @@ -1029,7 +1029,7 @@ spec: clientConfig: service: name: {{ .Values.webhook.serviceName }} - namespace: {{ .Release.Namespace }} + namespace: {{ .Values.webhook.serviceNamespace | default .Release.Namespace }} port: {{ .Values.webhook.port }} {{- end }} diff --git a/charts/karpenter-crd/values.yaml b/charts/karpenter-crd/values.yaml index bbd4cf1c4ffb..211f802de3f9 100644 --- a/charts/karpenter-crd/values.yaml +++ b/charts/karpenter-crd/values.yaml @@ -2,5 +2,6 @@ webhook: # -- Whether to enable the webhooks. enabled: false serviceName: karpenter + serviceNamespace: "" # -- The container port to use for the webhook. port: 8443 \ No newline at end of file diff --git a/hack/mutation/conversion_webhook_injection.sh b/hack/mutation/conversion_webhook_injection.sh index 65a3ab3c8503..0f2027d26494 100755 --- a/hack/mutation/conversion_webhook_injection.sh +++ b/hack/mutation/conversion_webhook_injection.sh @@ -18,7 +18,7 @@ echo "{{- if .Values.webhook.enabled }} clientConfig: service: name: {{ .Values.webhook.serviceName }} - namespace: {{ .Release.Namespace }} + namespace: {{ .Values.webhook.serviceNamespace | default .Release.Namespace }} port: {{ .Values.webhook.port }} {{- end }} " >> charts/karpenter-crd/templates/karpenter.sh_nodepools.yaml @@ -33,7 +33,7 @@ echo "{{- if .Values.webhook.enabled }} clientConfig: service: name: {{ .Values.webhook.serviceName }} - namespace: {{ .Release.Namespace }} + namespace: {{ .Values.webhook.serviceNamespace | default .Release.Namespace }} port: {{ .Values.webhook.port }} {{- end }} " >> charts/karpenter-crd/templates/karpenter.sh_nodeclaims.yaml @@ -48,7 +48,7 @@ echo "{{- if .Values.webhook.enabled }} clientConfig: service: name: {{ .Values.webhook.serviceName }} - namespace: {{ .Release.Namespace }} + namespace: {{ .Values.webhook.serviceNamespace | default .Release.Namespace }} port: {{ .Values.webhook.port }} {{- end }} " >> charts/karpenter-crd/templates/karpenter.k8s.aws_ec2nodeclasses.yaml \ No newline at end of file