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/chart/jenkins-operator/values.yaml b/chart/jenkins-operator/values.yaml
index 62d955afc..c39e32eb9 100644
--- a/chart/jenkins-operator/values.yaml
+++ b/chart/jenkins-operator/values.yaml
@@ -308,6 +308,10 @@ operator:
# fullnameOverride overrides the deployment name
fullnameOverride: ""
+ # Select a different namespace to look for the Jenkins CR and deploy Jenkins in. Defaults to the same namespace as
+ # the operator.
+ # watchNamespace: "jenkins-namespace"
+
resources: {}
nodeSelector: {}
tolerations: []
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..16c0ee428 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
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 property will be ignored. Use the `operator.watchNamespace` property instead.