From 6da412f7bcc0ef4d51cb3a68a38fd661b1268579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Valen=C3=A7a?= Date: Fri, 27 Oct 2023 16:22:11 +0100 Subject: [PATCH] Provides an Override to the WATCH_NAMESPACE env variable. In case the Jenkins instance is disabled, this commit allows us to pick a different namespace for the deployment by configuring the operator object instead of the jenkins object. --- chart/jenkins-operator/templates/operator.yaml | 2 ++ .../Getting Started/latest/installing-the-operator.md | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/chart/jenkins-operator/templates/operator.yaml b/chart/jenkins-operator/templates/operator.yaml index 917dc9e1a..967d22645 100644 --- a/chart/jenkins-operator/templates/operator.yaml +++ b/chart/jenkins-operator/templates/operator.yaml @@ -57,6 +57,8 @@ spec: - name: WATCH_NAMESPACE {{- if .Values.jenkins.enabled }} value: {{ .Values.jenkins.namespace }} + {{- else if .Values.operator.watchNamespace }} + value: {{ .Values.operator.watchNamespace }} {{- else }} valueFrom: fieldRef: diff --git a/website/content/en/docs/Getting Started/latest/installing-the-operator.md b/website/content/en/docs/Getting Started/latest/installing-the-operator.md index 9289c6e63..79d33715b 100644 --- a/website/content/en/docs/Getting Started/latest/installing-the-operator.md +++ b/website/content/en/docs/Getting Started/latest/installing-the-operator.md @@ -127,11 +127,13 @@ Name of resource. The pod name will be jenkins-<name> (name w namespace -default +"" -Namespace the resources will be deployed to. It's not recommended to use default namespace. -Create new namespace for jenkins (e.g. kubectl create -n jenkins) +Namespace the resources will be deployed to. If omitted, the resources will be deployed to the same namespace as the operator. +It's not recommended to use default namespace. Create new namespace for jenkins (e.g. kubectl create -n jenkins). + +Note: If the Jenkins instance is disabled, this propery will be ignored. Use the `operator.watchNamespace` property instead.