diff --git a/charts/karpenter-crd/templates/karpenter.k8s.aws_ec2nodeclasses.yaml b/charts/karpenter-crd/templates/karpenter.k8s.aws_ec2nodeclasses.yaml index 932ad720939e..6b161086df84 100644 --- a/charts/karpenter-crd/templates/karpenter.k8s.aws_ec2nodeclasses.yaml +++ b/charts/karpenter-crd/templates/karpenter.k8s.aws_ec2nodeclasses.yaml @@ -1303,7 +1303,7 @@ spec: clientConfig: service: name: {{ .Values.webhook.serviceName }} - namespace: {{ .Release.Namespace }} + namespace: {{ if .Values.webhook.serviceNamespace }} {{ .Values.webhook.serviceNamespace }} {{ else }} {{ .Release.Namespace }} {{ end }} 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 cb5a487c4570..0a7b8e60881f 100644 --- a/charts/karpenter-crd/templates/karpenter.sh_nodeclaims.yaml +++ b/charts/karpenter-crd/templates/karpenter.sh_nodeclaims.yaml @@ -826,7 +826,7 @@ spec: clientConfig: service: name: {{ .Values.webhook.serviceName }} - namespace: {{ .Release.Namespace }} + namespace: {{ if .Values.webhook.serviceNamespace }} {{ .Values.webhook.serviceNamespace }} {{ else }} {{ .Release.Namespace }} {{ end }} 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 38ce78ab2eb5..5782392de7d1 100644 --- a/charts/karpenter-crd/templates/karpenter.sh_nodepools.yaml +++ b/charts/karpenter-crd/templates/karpenter.sh_nodepools.yaml @@ -1077,7 +1077,7 @@ spec: clientConfig: service: name: {{ .Values.webhook.serviceName }} - namespace: {{ .Release.Namespace }} + namespace: {{ if .Values.webhook.serviceNamespace }} {{ .Values.webhook.serviceNamespace }} {{ else }} {{ .Release.Namespace }} {{ end }} port: {{ .Values.webhook.port }} {{- end }} diff --git a/charts/karpenter-crd/values.yaml b/charts/karpenter-crd/values.yaml index 4bd07029d05b..e26e9d2ebc11 100644 --- a/charts/karpenter-crd/values.yaml +++ b/charts/karpenter-crd/values.yaml @@ -2,5 +2,6 @@ webhook: # -- Whether to enable the webhooks. enabled: true 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_webhooks_injection.sh b/hack/mutation/conversion_webhooks_injection.sh index 65a3ab3c8503..081813d8f191 100755 --- a/hack/mutation/conversion_webhooks_injection.sh +++ b/hack/mutation/conversion_webhooks_injection.sh @@ -18,7 +18,7 @@ echo "{{- if .Values.webhook.enabled }} clientConfig: service: name: {{ .Values.webhook.serviceName }} - namespace: {{ .Release.Namespace }} + namespace: {{ if .Values.webhook.serviceNamespace }} {{ .Values.webhook.serviceNamespace }} {{ else }} {{ .Release.Namespace }} {{ end }} 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: {{ if .Values.webhook.serviceNamespace }} {{ .Values.webhook.serviceNamespace }} {{ else }} {{ .Release.Namespace }} {{ end }} 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: {{ if .Values.webhook.serviceNamespace }} {{ .Values.webhook.serviceNamespace }} {{ else }} {{ .Release.Namespace }} {{ end }} port: {{ .Values.webhook.port }} {{- end }} " >> charts/karpenter-crd/templates/karpenter.k8s.aws_ec2nodeclasses.yaml \ No newline at end of file