Skip to content

Add condition for cnpg - #496

Merged
hossain-rayhan merged 1 commit into
documentdb:mainfrom
DRSchlaubi:main
Nov 9, 2026
Merged

hossain-rayhan merged 1 commit into
documentdb:mainfrom
DRSchlaubi:main

Conversation

@DRSchlaubi

Copy link
Copy Markdown
Contributor

Fixes #495

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Disabling CloudNativePG still unconditionally manages cnpg-system, causing Helm ownership conflicts that block reuse of an existing installation unless namespace creation can be skipped while retaining sidecar and WAL-replica resources.

1 open issue
What changed in this PR

Adds a Helm option to disable the bundled CloudNative-PG dependency, supporting existing CNPG installations as requested in #495.

Changes:

  • Makes the CNPG dependency conditional on cloudnative-pg.enabled.
  • Defaults the option to true, preserving existing installation behavior.
File Description
operator/​documentdb-helm-chart/​values.yaml Adds the enabled-by-default CNPG installation option.
operator/​documentdb-helm-chart/​Chart.yaml Applies the option to the CNPG dependency.

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

A template syntax error prevents chart rendering, and CNPG-dependent namespace handling can cause installation failures or delete the namespace and its contents during upgrades.

3 open issues

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Critical issues remain: inline Helm whitespace trimming produces invalid YAML, and disabling the CNPG dependency during an upgrade can delete the managed Namespace and its database workloads.

4 open issues
1 resolved since last review

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Disabling CNPG during an upgrade causes Helm to delete the previously managed namespace, destroying retained sidecar and TLS resources and other workloads without a safe retention or migration path.

4 open issues
1 resolved since last review

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Human assessment is needed because the namespace lifecycle changes can delete existing workloads during upgrades or cause Helm ownership conflicts during installation.

3 open issues
1 resolved since last review

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The namespace condition can cause Helm upgrades with cloudnative-pg.enabled=false or legacy --reuse-values to delete the release-owned namespace, destroying the sidecar injector, TLS Secrets, and other resources.

1 open issue
3 resolved since last review

Review effort: Balanced

@@ -1,7 +1,9 @@
{{- if and (index .Values "cloudnative-pg").enabled (index .Values "cloudnative-pg").namespaceOverride }}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't rally know what's the best approach here

Users having the operator installed are unlikely to have an existing CNPG installation, as it would clash with the operator already. in order to resolve this a new "createNamespace" value would be needed which new users wanting to skip cnpg installation would also need to set and might fall into the trap of not doing and therefore bricking the install

@documentdb-triage-tool documentdb-triage-tool Bot added enhancement New feature or request go Pull requests that update go code labels Nov 5, 2026
@documentdb-triage-tool

Copy link
Copy Markdown

🤖 Auto-triaged by documentdb-triage-tool.

Applied: go, enhancement
Project fields suggested: Component controllers · Priority P2 · Effort M · Status Needs Review
Confidence: 0.50 (mixed)

Reasoning

effort from diff stats (21+13 LOC, 5 files); LLM: Small bug fix PR addressing issue #495 related to a missing CNPG condition in the controllers logic.

If a label is wrong, remove it manually and ping @patty-chow so the rules can be tuned. The bot will not re-label items that already have component labels.

@DRSchlaubi DRSchlaubi reopened this Nov 9, 2026
- Add option to specify cnpg namespace

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Signed-off-by: Michael Rittmeister <[email protected]>
@DRSchlaubi

Copy link
Copy Markdown
Contributor Author

Rebase to get DCO to pass

@hossain-rayhan
hossain-rayhan merged commit f59bcdf into documentdb:main Nov 9, 2026
6 checks passed
hossain-rayhan added a commit to hossain-rayhan/documentdb-kubernetes-operator that referenced this pull request Nov 16, 2026
Prepare operator 1.2.0, the first release with the documentdb.io/v1 API.
The default DocumentDB engine stays at 1.0.0.

- Chart.yaml version/appVersion 1.1.1 -> 1.2.0; Helm test image tags
- CHANGELOG: [Unreleased] -> [1.2.0] - 2026-11-11 with summary; add the
  documentdb#496 and documentdb#493 changes that shipped in 1.1.1; fix the 1.1.0 date
  (released 2026-11-04)
- release-strategy.md: v1.2.x support, Kubernetes, dependency and
  component rows
- before-you-start.md / index.md: operator 1.2.0
- upgrades.md: the CRD step is required from 1.1.x too, not only 1.0.x;
  document rolling back from 1.2.0 to 1.1.x

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 9f1a71b4-9969-4456-9f65-8d19dd550d8e
Signed-off-by: Rayhan Hossain <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request go Pull requests that update go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add option to install without CNPG

4 participants