Skip to content

chore(mongodb): bump psmdb-operator and CR to 1.22.0 - #2968

Merged
Aleksei Sviridkin (lexfrei) merged 3 commits into
mainfrom
chore/bump-mongodb-operator-1.22.0
Jun 23, 2026
Merged

Aleksei Sviridkin (lexfrei) merged 3 commits into
mainfrom
chore/bump-mongodb-operator-1.22.0

Conversation

@lexfrei

@lexfrei Aleksei Sviridkin (lexfrei) commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does

Bumps the Percona Operator for MongoDB stack from 1.21.x to 1.22.0 (latest upstream release), picking up the published security fixes in the operator image that the issue enumerates.

Two coupled changes:

  • system/mongodb-operator: re-vendors the upstream psmdb-operator chart 1.21.2 → 1.22.0 via make update (operator image → percona/percona-server-mongodb-operator:1.22.0). The vendored tree is byte-for-byte identical to a fresh upstream pull.
  • apps/mongodb: bumps the managed CR spec.crVersion 1.21.1 → 1.22.0 so the platform tracks the deployed operator instead of running at the N-1 skew, plus the matching helm-unittest assertion.

The 1.22.0 CRD diff is additive (native MinIO backup storage, storage scaling, hookScript, PBMReady condition, new metrics.k8s.io RBAC that activates under our watchAllNamespaces: true). The only schema removal — the restore-spec replset string, renamed upstream to replsetRemapping — is unused by the cozystack mongodb app (restore template uses clusterName/pitr/backupSource only). Deprecations (PSMDB 6.0, PMM2, enableVolumeExpansion) stay backward-compatible. The PBM (2.11.0) and PMM (2.44.1, disabled by default) sidecars stay compatible with 1.22.0 and are out of scope here.

Verified: helm unittest packages/apps/mongodb 94/94 pass; helm template renders the operator with the new image.

Upgrade note: Helm v3 does not update CRDs on helm upgrade. On existing clusters the 1.22.0 CRD must be applied manually (kubectl apply --server-side -f .../crds/crd.yaml); the operator pod itself runs fine against the older CRD until then.

Closes #2888

Release note

chore(mongodb): bump psmdb-operator to 1.22.0 and managed CR to crVersion 1.22.0

Summary by CodeRabbit

Release Notes

  • New Features

    • MongoDB Operator upgraded to version 1.22.0 with enhanced custom resource definitions supporting backup storage configuration, hook scripts, and storage autoscaling capabilities
    • Added configurable namespace override for flexible operator deployment
    • Extended RBAC permissions for metrics collection
  • Chores

    • Kubernetes minimum version requirement updated to 1.32+
    • Helm chart version bumped to 1.22.0
  • Documentation

    • Expanded CRD upgrade and installation guidance with multiple upgrade strategies

@lexfrei
Aleksei Sviridkin (lexfrei) marked this pull request as ready for review June 22, 2026 09:56
@github-actions github-actions Bot added area/uncategorized PR auto-labeler could not map title scope to a known area/*; please review kind/cleanup Categorizes issue or PR as related to cleanup of code, process, or technical debt size/XS This PR changes 0-9 lines, ignoring generated files labels Jun 22, 2026
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request updates the Percona Operator for MongoDB to version 1.22.0. The changes include re-vendoring the operator chart and bumping the managed CR version to maintain alignment with the latest upstream release. These updates are primarily focused on security improvements and ensuring the platform remains compatible with the latest operator features.

Highlights

  • Dependency Update: Upgraded the Percona Operator for MongoDB stack from 1.21.x to 1.22.0 to incorporate critical security fixes.
  • Configuration Update: Updated the managed CR version to 1.22.0 to ensure compatibility with the new operator version.
  • Test Verification: Updated helm-unittest assertions to reflect the new CR version, ensuring all tests pass with the updated configuration.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Ignored Files
  • Ignored by pattern: **/charts/** (9)
    • packages/system/mongodb-operator/charts/psmdb-operator/Chart.yaml
    • packages/system/mongodb-operator/charts/psmdb-operator/README.md
    • packages/system/mongodb-operator/charts/psmdb-operator/crds/crd.yaml
    • packages/system/mongodb-operator/charts/psmdb-operator/templates/NOTES.txt
    • packages/system/mongodb-operator/charts/psmdb-operator/templates/_helpers.tpl
    • packages/system/mongodb-operator/charts/psmdb-operator/templates/deployment.yaml
    • packages/system/mongodb-operator/charts/psmdb-operator/templates/role-binding.yaml
    • packages/system/mongodb-operator/charts/psmdb-operator/templates/role.yaml
    • packages/system/mongodb-operator/charts/psmdb-operator/values.yaml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment Gemini (@gemini-code-assist) Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on Gemini (@gemini-code-assist) comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@coderabbitai

coderabbitai Bot commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a341644f-b75a-466b-b43c-5fd3767e7018

📥 Commits

Reviewing files that changed from the base of the PR and between 82b8c46 and e9aaee2.

📒 Files selected for processing (13)
  • packages/apps/mongodb/templates/mongodb.yaml
  • packages/apps/mongodb/tests/mongodb_test.yaml
  • packages/core/platform/sources/mongodb-operator.yaml
  • packages/core/platform/tests/sources_mongodb_operator_crds_test.yaml
  • packages/system/mongodb-operator/charts/psmdb-operator/Chart.yaml
  • packages/system/mongodb-operator/charts/psmdb-operator/README.md
  • packages/system/mongodb-operator/charts/psmdb-operator/crds/crd.yaml
  • packages/system/mongodb-operator/charts/psmdb-operator/templates/NOTES.txt
  • packages/system/mongodb-operator/charts/psmdb-operator/templates/_helpers.tpl
  • packages/system/mongodb-operator/charts/psmdb-operator/templates/deployment.yaml
  • packages/system/mongodb-operator/charts/psmdb-operator/templates/role-binding.yaml
  • packages/system/mongodb-operator/charts/psmdb-operator/templates/role.yaml
  • packages/system/mongodb-operator/charts/psmdb-operator/values.yaml

📝 Walkthrough

(Note: the review stack above was auto-corrected — all range IDs appear exactly once below in the proper layer assignments.)

(Self-correction: range_8269 and range_18455 and range_19098 and range_25262 do not appear in all_range_ids — only IDs from all_range_ids are valid. Re-assigning below with only valid IDs.)

Walkthrough

Upgrades the Percona Server MongoDB Operator from 1.21.1 to 1.22.0. Updates chart metadata, CR template, and test assertions. Adds upgradeCRDs: CreateReplace to the PackageSource install config with a test. Introduces a psmdb-operator.namespace Helm helper wired throughout templates. Expands CRD schemas with minio, hookScript, userAnnotations, env/envFrom, storageScaling, vault, and storageAutoscaling fields.

Changes

MongoDB Operator 1.22.0 Upgrade

Layer / File(s) Summary
Version bump: chart metadata, CR template, and tests
packages/system/mongodb-operator/charts/psmdb-operator/Chart.yaml, packages/system/mongodb-operator/charts/psmdb-operator/values.yaml, packages/apps/mongodb/templates/mongodb.yaml, packages/apps/mongodb/tests/mongodb_test.yaml
Chart appVersion and version bumped to 1.22.0, new maintainer added, operator image tag updated, spec.crVersion set to 1.22.0 in the CR template, and test description/assertion updated to match.
CRD upgrade policy: upgradeCRDs CreateReplace
packages/core/platform/sources/mongodb-operator.yaml, packages/core/platform/tests/sources_mongodb_operator_crds_test.yaml
upgradeCRDs: CreateReplace added to the mongodb-operator PackageSource install configuration; a new test suite verifies this policy is set for the cozystack.mongodb-operator component.
psmdb-operator.namespace helper and template wiring
packages/system/mongodb-operator/charts/psmdb-operator/templates/_helpers.tpl, packages/system/mongodb-operator/charts/psmdb-operator/values.yaml, packages/system/mongodb-operator/charts/psmdb-operator/templates/deployment.yaml, packages/system/mongodb-operator/charts/psmdb-operator/templates/role.yaml, packages/system/mongodb-operator/charts/psmdb-operator/templates/role-binding.yaml, packages/system/mongodb-operator/charts/psmdb-operator/templates/NOTES.txt
New psmdb-operator.namespace helper added returning namespaceOverride or Release.Namespace. namespaceOverride: "" added to values. Helper wired into deployment namespace, WATCH_NAMESPACE default, optional revisionHistoryLimit, ServiceAccount, RoleBinding subject, Role, and NOTES.txt commands. New metrics.k8s.io pod get/list RBAC rules added under watch conditions.
CRD schema additions for v1.22.0
packages/system/mongodb-operator/charts/psmdb-operator/crds/crd.yaml
All CRD version labels updated to v1.22.0. Schema additions: default/minimum on startingDeadlineSeconds; expanded minio blocks in backups, restores, storages; replset replaced by replsetRemapping map; hookScript schema added in multiple locations; userAnnotations maps added; env/envFrom arrays with full valueFrom sub-schemas added in multiple replica set/shard sections; new storageScaling with autoscaling config and CEL cross-field validations; vault config object with URL validation; storageAutoscaling status mapping.
README: updated install instructions and parameters
packages/system/mongodb-operator/charts/psmdb-operator/README.md
Kubernetes minimum version raised to 1.32+. Installation instructions expanded with two install methods and a new CRD upgrade section covering Helm and kubectl procedures. Example commands updated to version 1.22.0; configurable parameters table refreshed.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

🐇 Hop, hop, version one-twenty-two is here!
CRDs grow wider with minio and vault so dear,
A namespace helper hops through every template line,
CreateReplace keeps the upgrades running fine.
The rabbit stamps the chart and test with glee —
From 1.21 to 1.22, as fresh as can be! 🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: bumping psmdb-operator and CR to 1.22.0, which matches the primary objective of upgrading from 1.21.x to 1.22.0.
Linked Issues check ✅ Passed The PR fully addresses issue #2888 requirements: bumping system/mongodb-operator to the latest upstream release (1.22.0) with security vulnerability fixes, including helm template/lint validation and CRD update handling.
Out of Scope Changes check ✅ Passed All changes directly support the upgrade objective: version bumps (1.21.x→1.22.0), CRD updates, Helm chart metadata, deployment templates using namespace helper, RBAC rule additions for metrics.k8s.io, and corresponding test updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/bump-mongodb-operator-1.22.0

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Trivy (0.69.3)

Trivy execution failed: 2026-06-22T16:13:38Z FATAL Fatal error run error: fs scan error: scan error: scan failed: failed analysis: post analysis error: post analysis error: kubernetes scan error: fs filter error: fs filter error: walk error range error: stat smartylint.json: no such file or directory: range error: stat smartylint.json: no such file or directory


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dosubot dosubot Bot added the area/database Issues or PRs related to managed databases (postgres, mariadb, redis, etcd, kafka, clickhouse) label Jun 22, 2026

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request updates the MongoDB application's crVersion from 1.21.1 to 1.22.0 in both the template configuration and the associated test assertions. I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Re-vendors the Percona Operator for MongoDB Helm chart from 1.21.2 to 1.22.0,
moving the operator image to 1.22.0 and picking up the published security
fixes. The CRD gains additive fields (native MinIO backup storage, storage
scaling) and new metrics.k8s.io RBAC. The only schema removal -- the
restore-spec `replset` string, replaced by `replsetRemapping` -- is unused by
cozystack's mongodb app (restore.yaml uses clusterName/pitr/backupSource only).
Deprecations (PSMDB 6.0, PMM2, enableVolumeExpansion) stay backward-compatible;
the watchAllNamespaces override remains valid.

Note: Helm v3 does not update CRDs on `helm upgrade`; the bumped CRD must be
applied manually on existing clusters per Percona's upgrade docs.

Adaptations:
- charts/: re-vendored via `make update` (helm pull psmdb-operator 1.22.0)

Assisted-By: Claude <[email protected]>
Signed-off-by: Aleksei Sviridkin <[email protected]>
Matches the managed MongoDB CR (`spec.crVersion`) to the psmdb-operator 1.22.0
bump so the platform tracks the deployed operator instead of running at the
N-1 skew. The 1.22.0 CR schema is additive (no new required fields), so
existing instances reconcile cleanly under SmartUpdate. PMM (disabled by
default) and the PBM 2.11.0 sidecar stay compatible with operator 1.22.0;
refreshing their image matrix is a separate apps/mongodb concern.

Adaptations:
- templates/mongodb.yaml: spec.crVersion 1.21.1 -> 1.22.0
- tests/mongodb_test.yaml: update crVersion assertion to 1.22.0

Assisted-By: Claude <[email protected]>
Signed-off-by: Aleksei Sviridkin <[email protected]>
psmdb-operator evolves its CRD schema between minor versions; 1.22.0 adds
spec.storageScaling/storageAutoscaling, vault and other fields. Helm never
upgrades CRDs shipped in crds/, so without an explicit policy the operator
binary upgrades on an existing cluster while the live CRD stays behind and
the apiserver rejects the new fields. Opt the mongodb-operator PackageSource
into CreateReplace, consistent with etcd-operator, and add a platform test
pinning the policy.

Assisted-By: Claude <[email protected]>
Signed-off-by: Aleksei Sviridkin <[email protected]>
@lexfrei
Aleksei Sviridkin (lexfrei) force-pushed the chore/bump-mongodb-operator-1.22.0 branch from ebc9b99 to e9aaee2 Compare June 22, 2026 16:12
@github-actions github-actions Bot added size/S This PR changes 10-29 lines, ignoring generated files and removed size/XS This PR changes 0-9 lines, ignoring generated files labels Jun 22, 2026

@myasnikovdaniil myasnikovdaniil 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.

APPROVE — clean, well-scoped operator+CR bump. The CRD regeneration is additive-safe and the upgrade path is handled correctly.

Verified the migration-safety angle (the main risk here):

  • The +808-line CRD diff is additive. The only schema removal is replset → replsetRemapping in the Restore CRD, which cozystack's restore.yaml never sets (it uses only clusterName/pitr/backupSource), and Restore CRs are one-shot/ephemeral — so no live cozystack-managed object is invalidated by the CreateReplace.
  • The two new constraints on the pre-existing startingDeadlineSeconds (default: 120, minimum: 1) don't re-validate already-stored objects, so existing CRs aren't rejected on upgrade.
  • Good call wiring upgradeCRDs: CreateReplace into the PackageSource (consistent with etcd-operator) plus a unittest to pin it — that's the right fix for "Helm v3 doesn't upgrade CRDs", and it makes the upgrade self-applying.

dev10 verification (k8s 1.35.4): server-side-applied the new CRD (clean), upgraded the operator to 1.22.0 (starts clean, acquires leadership, all controllers up), deployed a managed MongoDB at crVersion 1.22.0 → reached ready (mongoVersion 8.0.17-6), and a connect + write + read-back succeeded with a healthy single-member replica set. Local helm unittest: 94/94 (app) and 60/60 (platform, incl. the new CRD-policy test).

Re-vendoring hygiene: clean upstream pull (the update target re-pulls from scratch, no local patches), the only cozystack override is watchAllNamespaces: true, and the new metrics.k8s.io RBAC is gated on watch-namespace so it correctly activates under our config. App values.yaml/schema/README untouched — no regen needed.

Two non-blocking nits inline. The branch also just needs a rebase past the v1.5.0 release commits to clear BLOCKED.

install:
namespace: cozy-mongodb-operator
releaseName: mongodb-operator
upgradeCRDs: CreateReplace

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.

nit: This upgradeCRDs: CreateReplace actually automates the CRD upgrade on helm upgrade, but the PR description's "Upgrade note" still says the 1.22.0 CRD "must be applied manually (kubectl apply --server-side)". The body undersells the fix — worth updating it so operators don't think a manual step is still required after this merges. (Verified on dev10: server-side apply of the new CRD is clean, and CreateReplace maps to HelmRelease.Spec.Upgrade.CRDs.)

rule: self.type != 'latest' || !has(self.date)
replset:
type: string
replsetRemapping:

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.

nit (non-blocking): This replset → replsetRemapping rename is the single schema removal in the diff, and it lands on the Restore CRD which CreateReplace will force-replace. The PackageSource doc itself warns CreateReplace "may cause data loss if upstream drops fields from a CRD with live objects." Confirmed safe for cozystack — apps/mongodb/templates/restore.yaml only sets clusterName/pitr/backupSource, and Restore CRs are one-shot — but a customer who hand-authored a Restore CR with replset set would have that value pruned on upgrade. Flagging for the record; no change needed.

@lexfrei
Aleksei Sviridkin (lexfrei) merged commit 553c0be into main Jun 23, 2026
18 of 20 checks passed
@lexfrei
Aleksei Sviridkin (lexfrei) deleted the chore/bump-mongodb-operator-1.22.0 branch June 23, 2026 10:13
@lexfrei Aleksei Sviridkin (lexfrei) removed the area/uncategorized PR auto-labeler could not map title scope to a known area/*; please review label Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/database Issues or PRs related to managed databases (postgres, mariadb, redis, etcd, kafka, clickhouse) kind/cleanup Categorizes issue or PR as related to cleanup of code, process, or technical debt size/S This PR changes 10-29 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore(mongodb-operator): bump system/mongodb-operator images to current upstream release

2 participants