Skip to content

Commit 553c0be

Browse files
authored
chore(mongodb): bump psmdb-operator and CR to 1.22.0 (cozystack#2968)
## 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 cozystack#2888 ### Release note ```release-note chore(mongodb): bump psmdb-operator to 1.22.0 and managed CR to crVersion 1.22.0 ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## 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 <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2 parents 8c01706 + e9aaee2 commit 553c0be

13 files changed

Lines changed: 930 additions & 30 deletions

File tree

‎packages/apps/mongodb/templates/mongodb.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ metadata:
88
- percona.com/delete-psmdb-pods-in-order
99
- percona.com/delete-psmdb-pvc
1010
spec:
11-
crVersion: 1.21.1
11+
crVersion: 1.22.0
1212
clusterServiceDNSSuffix: svc.{{ $clusterDomain }}
1313
secrets:
1414
users: {{ .Release.Name }}-percona-server-mongodb-users

‎packages/apps/mongodb/tests/mongodb_test.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ tests:
106106
# CR Version #
107107
##################
108108

109-
- it: sets crVersion to 1.21.1
109+
- it: sets crVersion to 1.22.0
110110
release:
111111
name: test-mongodb
112112
namespace: tenant-test
@@ -116,7 +116,7 @@ tests:
116116
asserts:
117117
- equal:
118118
path: spec.crVersion
119-
value: "1.21.1"
119+
value: "1.22.0"
120120
documentIndex: 0
121121

122122
#####################

‎packages/core/platform/sources/mongodb-operator.yaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ spec:
2121
install:
2222
namespace: cozy-mongodb-operator
2323
releaseName: mongodb-operator
24+
upgradeCRDs: CreateReplace
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
suite: mongodb-operator applies CRD updates on upgrade
2+
# psmdb-operator evolves its CRD schema between minor versions (1.21 -> 1.22 adds
3+
# storageScaling/storageAutoscaling, vault and other fields). Helm never upgrades
4+
# CRDs shipped in crds/, so the PackageSource must opt into CreateReplace; without
5+
# it the operator binary upgrades while the live CRD stays behind and the
6+
# apiserver rejects the new fields on existing clusters. Pin the policy so an
7+
# upgrade cannot silently regress.
8+
templates:
9+
- templates/sources.yaml
10+
release:
11+
name: cozystack
12+
namespace: cozy-system
13+
tests:
14+
- it: mongodb-operator PackageSource sets upgradeCRDs to CreateReplace
15+
documentSelector:
16+
path: metadata.name
17+
value: cozystack.mongodb-operator
18+
asserts:
19+
- equal:
20+
path: spec.variants[0].components[0].install.upgradeCRDs
21+
value: CreateReplace
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
apiVersion: v2
2-
appVersion: 1.21.1
2+
appVersion: 1.22.0
33
description: A Helm chart for deploying the Percona Operator for MongoDB
44
home: https://docs.percona.com/percona-operator-for-mongodb/
55
maintainers:
@@ -9,5 +9,7 @@ maintainers:
99
name: jvpasinatto
1010
1111
name: eleo007
12+
13+
name: valmiranogueira
1214
name: psmdb-operator
13-
version: 1.21.2
15+
version: 1.22.0

‎packages/system/mongodb-operator/charts/psmdb-operator/README.md‎

Lines changed: 59 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Useful links:
66
- [Operator Documentation](https://www.percona.com/doc/kubernetes-operator-for-psmongodb/index.html)
77

88
## Pre-requisites
9-
* Kubernetes 1.30+
9+
* Kubernetes 1.32+
1010
* Helm v3
1111

1212
# Installation
@@ -15,30 +15,82 @@ This chart will deploy the Operator Pod for the further Percona Server for Mongo
1515

1616
## Installing the chart
1717

18-
To install the chart with the `psmdb` release name using a dedicated namespace (recommended):
18+
There are two ways to insall operator: using separate chart with operator Custom Resource Defenitions or using CRDs from the `crds/` directory.
19+
20+
### Using separate chart
21+
22+
Install CRD chart:
1923

2024
```sh
2125
helm repo add percona https://percona.github.io/percona-helm-charts/
22-
helm install my-operator percona/psmdb-operator --version 1.21.2 --namespace my-namespace
26+
helm install psmdb-operator-crds percona/psmdb-operator-crds --namespace psmdb --create-namespace
27+
```
28+
> **Note:** Deleting CRD chart will trigger deletion of all the custom resources created using the CRDs thus deleting all clusters.
29+
> Uninstalling percona/psmdb-operator-crds chart should be approached with caution.
30+
31+
32+
Install operator chart:
33+
```sh
34+
helm install my-operator percona/psmdb-operator --version 1.22.0 --namespace my-namespace
35+
```
36+
37+
### Using the `crds/` directory.
38+
39+
```sh
40+
helm repo add percona https://percona.github.io/percona-helm-charts/
41+
helm install my-operator percona/psmdb-operator --version 1.22.0 --namespace my-namespace
42+
```
43+
44+
## Upgrading CRDs
45+
46+
By default, Helm installs CRDs from the `crds/` directory only during initial installation and does not upgrade them. To upgrade CRDs, you have two options:
47+
48+
### Option 1: Use the Separate CRD Chart
49+
50+
Install or upgrade CRDs using the dedicated CRD chart:
51+
52+
```sh
53+
helm repo update
54+
helm upgrade --install psmdb-operator-crds percona/psmdb-operator-crds --namespace my-namespace
2355
```
2456

57+
> **Note:** If you're using Helm 3.17.0 or later, use `--take-ownership` to take over CRDs that were previously installed via the `crds/` directory:
58+
>
59+
> ```sh
60+
> helm upgrade --install psmdb-operator-crds percona/psmdb-operator-crds --namespace my-namespace --take-ownership
61+
> ```
62+
63+
For Helm versions older than 3.17.0, manually add ownership labels and annotations before running the upgrade:
64+
65+
```sh
66+
CRDS=(perconaservermongodbs.psmdb.percona.com perconaservermongodbbackups.psmdb.percona.com perconaservermongodbrestores.psmdb.percona.com)
67+
kubectl label crds "${CRDS[@]}" app.kubernetes.io/managed-by=Helm --overwrite
68+
kubectl annotate crds "${CRDS[@]}" meta.helm.sh/release-name=psmdb-operator-crds --overwrite
69+
kubectl annotate crds "${CRDS[@]}" meta.helm.sh/release-namespace=my-namespace --overwrite
70+
```
71+
72+
### Option 2: Use kubectl to upgrade the CRDs
73+
74+
kubectl apply --server-side -f https://raw.githubusercontent.com/percona/percona-server-mongodb-operator/v1.22.0/deploy/crd.yaml -n my-namespace
75+
76+
2577
The chart can be customized using the following configurable parameters:
2678

2779
| Parameter | Description | Default |
2880
| ---------------------------- | ------------------------------------------------------------------------------------------------------------ | ----------------------------------------- |
2981
| `image.repository` | PSMDB Operator Container image name | `percona/percona-server-mongodb-operator` |
30-
| `image.tag` | PSMDB Operator Container image tag | `1.21.1` |
31-
| `image.pullPolicy` | PSMDB Operator Container pull policy | `Always` |
32-
| `image.pullSecrets` | PSMDB Operator Pod pull secret | `[]` |
82+
| `image.tag` | PSMDB Operator Container image tag | `1.22.0` |
83+
| `image.pullPolicy` | PSMDB Operator Container pull policy | `IfNotPresent` |
84+
| `imagePullSecrets` | PSMDB Operator Pod pull secret | `[]` |
3385
| `replicaCount` | PSMDB Operator Pod quantity | `1` |
86+
| `revisionHistoryLimit` | Quantity of old ReplicaSets to retain for rollback purposes | `` |
3487
| `tolerations` | List of node taints to tolerate | `[]` |
3588
| `annotations` | PSMDB Operator Deployment annotations | `{}` |
3689
| `podAnnotations` | PSMDB Operator Pod annotations | `{}` |
3790
| `labels` | PSMDB Operator Deployment labels | `{}` |
3891
| `podLabels` | PSMDB Operator Pod labels | `{}` |
3992
| `resources` | Resource requests and limits | `{}` |
4093
| `nodeSelector` | Labels for Pod assignment | `{}` |
41-
| `podAnnotations` | Annotations for pod | `{}` |
4294
| `podSecurityContext` | Pod Security Context | `{}` |
4395
| `watchNamespace` | Set when a different from default namespace is needed to watch (comma separated if multiple needed) | `""` |
4496
| `createNamespace` | Set if you want to create watched namespaces with helm | `false` |

0 commit comments

Comments
 (0)