From a723318894c6251e1f6630eb6d1154866d42a1f3 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 9a74056da2fa..550e4c3e35c0 100644 --- a/charts/karpenter-crd/templates/karpenter.k8s.aws_ec2nodeclasses.yaml +++ b/charts/karpenter-crd/templates/karpenter.k8s.aws_ec2nodeclasses.yaml @@ -1271,7 +1271,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 418d147e5053..d41abe176bb5 100644 --- a/charts/karpenter-crd/templates/karpenter.sh_nodeclaims.yaml +++ b/charts/karpenter-crd/templates/karpenter.sh_nodeclaims.yaml @@ -811,7 +811,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 5614a733122c..bee4fcb75589 100644 --- a/charts/karpenter-crd/templates/karpenter.sh_nodepools.yaml +++ b/charts/karpenter-crd/templates/karpenter.sh_nodepools.yaml @@ -972,7 +972,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 2b66f3f98800..178456589a63 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 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