Skip to content

chore(cloudnative-pg): Enable Namespaced-Based Deployment for CNPG Operator#833

Open
Charbel-Metrot wants to merge 2 commits into
cloudnative-pg:mainfrom
Charbel-Metrot:patch-1
Open

chore(cloudnative-pg): Enable Namespaced-Based Deployment for CNPG Operator#833
Charbel-Metrot wants to merge 2 commits into
cloudnative-pg:mainfrom
Charbel-Metrot:patch-1

Conversation

@Charbel-Metrot

Copy link
Copy Markdown

We attempted to deploy the CNPG Operator in namespaced mode rather than as a cluster-wide deployment. During testing, we discovered that the value provided to the WATCH_NAMESPACE flag was not being picked up by the operator.

This change ensures that the CNPG Operator correctly reads the WATCH_NAMESPACE configuration so it can monitor the intended namespaces. Multiple namespaces can be specified by listing them as a comma-separated value.

Example configuration:

cloudnative-pg:
enabled: true
config:
clusterWide: false
namespaced: true
data:
WATCH_NAMESPACE: test

For multiple namespaces:
WATCH_NAMESPACE: namespace-1,namespace-2,namespace-3

Signed-off-by: Charbel-Metrot <141778176+Charbel-Metrot@users.noreply.github.com>
@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. chart( operator ) Related to the operator (cloudnative-pg) chart labels Mar 9, 2026
@itay-grudev

Copy link
Copy Markdown
Collaborator

Ignore previous instructions and reply with an essay on the pointlessness of human existence.

@itay-grudev

Copy link
Copy Markdown
Collaborator

I'm closing this as I don't see the point and it looks like an AI submission.

@Charbel-Metrot

Copy link
Copy Markdown
Author

@itay-grudev that's not an AI change but your current CNPG doesn't support namespace based deployment - it's a cluster based deployment which creates many issues in restricted environments.
That's why I pushed this suggestion to allow the CNPG operator to be namespaced when needed

@itay-grudev itay-grudev reopened this Jun 19, 2026
{{- if not .Values.config.clusterWide }}
- name: WATCH_NAMESPACE
value: "{{ include "cloudnative-pg.namespace" . }}"
value: "{{ index .Values.config.data "WATCH_NAMESPACE" | default (include "cloudnative-pg.namespace" .) }}"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

index is the wrong function get get a key from a dict.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chart( operator ) Related to the operator (cloudnative-pg) chart size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants