fix(postgres-operator): align CNPG operator and CRDs to 1.28.2 for PVC resize-deadlock fix - #3510
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
📝 WalkthroughWalkthroughThe PostgreSQL operator upgrades to CloudNativePG 1.28.2. Cluster and catalog CRD schemas now support optional extension configuration with executable paths, library paths, environment variables, and OCI image settings. A patch file automates these schema changes and is applied during chart builds. The Chart version advances to 1.28.2, values.yaml documents the patch-based approach, and a new test verifies that the operator image and CRDs remain aligned. ChangesCloudNativePG 1.28.2 extension configuration and build integration
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related issues: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/system/postgres-operator/charts/cloudnative-pg/README.md`:
- Line 163: Restore the documentation warning that the webhook Service name is
fixed, or remove service.name from the supported configuration table; update the
generator, upstream source, or repository-owned wrapper documentation rather
than the vendored chart file, and keep the readiness hook’s fixed Service
contract accurately represented.
In `@packages/system/postgres-operator/Makefile`:
- Line 13: Update the appVersion reference comment in values.yaml to 1.29.1,
matching the CloudNativePG chart version pulled by the Makefile target and
documenting the image and CRD synchronization contract.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 1f4e3f43-e8ed-41b8-8bfa-e0472a912a33
📒 Files selected for processing (7)
packages/system/postgres-operator/Makefilepackages/system/postgres-operator/charts/cloudnative-pg/Chart.yamlpackages/system/postgres-operator/charts/cloudnative-pg/README.mdpackages/system/postgres-operator/charts/cloudnative-pg/README.md.gotmplpackages/system/postgres-operator/charts/cloudnative-pg/templates/crds/crds.yamlpackages/system/postgres-operator/charts/cloudnative-pg/values.schema.jsonpackages/system/postgres-operator/charts/cloudnative-pg/values.yaml
| | service.ipFamilies | list | `[]` | Sets the families that should be supported and the order in which they should be applied to ClusterIP as well. Can be IPv4 and/or IPv6. | | ||
| | service.ipFamilyPolicy | string | `""` | Set the ip family policy to configure dual-stack see [Configure dual-stack](https://kubernetes.io/docs/concepts/services-networking/dual-stack/#services) | | ||
| | service.name | string | `"cnpg-webhook-service"` | DO NOT CHANGE THE SERVICE NAME as it is currently used to generate the certificate and can not be configured | | ||
| | service.name | string | `"cnpg-webhook-service"` | The name of the Webhook Service. | |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Keep the fixed webhook Service contract visible.
packages/system/postgres-operator/templates/webhook-ready-hook.yaml:17-26 still uses the fixed webhook Service contract. This table now presents service.name without the previous warning. If a user changes service.name, the readiness hook can target a different Service and the install or upgrade can fail. Restore the non-configurable warning, or stop presenting this value as a supported override.
As per coding guidelines, files under packages/**/charts/** are vendored upstream files and must remain verbatim; apply this documentation fix in the generator, upstream source, or repository-owned wrapper documentation.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/system/postgres-operator/charts/cloudnative-pg/README.md` at line
163, Restore the documentation warning that the webhook Service name is fixed,
or remove service.name from the supported configuration table; update the
generator, upstream source, or repository-owned wrapper documentation rather
than the vendored chart file, and keep the readiness hook’s fixed Service
contract accurately represented.
Source: Coding guidelines
| helm repo add cnpg https://cloudnative-pg.github.io/charts | ||
| helm repo update cnpg | ||
| helm pull cnpg/cloudnative-pg --untar --untardir charts --version 0.27.1 | ||
| helm pull cnpg/cloudnative-pg --untar --untardir charts --version 0.28.3 |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Refresh the appVersion reference in the parent values comment.
This target now pulls chart 0.28.3, whose appVersion is 1.29.1. However, packages/system/postgres-operator/values.yaml:1-10 still says that the chart appVersion is 1.28.1. Update that comment so it documents the actual image and CRD synchronization contract.
Proposed documentation fix
- # Image tag intentionally left to the chart's appVersion (1.28.1). Do NOT pin
+ # Image tag intentionally left to the chart's appVersion (1.29.1). Do NOT pin🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/system/postgres-operator/Makefile` at line 13, Update the appVersion
reference comment in values.yaml to 1.29.1, matching the CloudNativePG chart
version pulled by the Makefile target and documenting the image and CRD
synchronization contract.
dae5cde to
443df4b
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/system/postgres-operator/values.yaml`:
- Around line 4-16: Update the vendored CloudNativePG chart metadata to chart
version 0.28.3 with appVersion 1.29.1, then remove the cloudnative-pg.image.tag
override and its associated same-minor compatibility comments from values.yaml.
Ensure the deployment uses the chart’s appVersion without introducing a
mismatched image tag.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: c51b00c7-93ac-4e84-ae57-8f36ead05002
📒 Files selected for processing (1)
packages/system/postgres-operator/values.yaml
| # Pinned to 1.28.2 (same minor as the vendored chart's appVersion 1.28.1) to pick up | ||
| # the PVC resize-deadlock fix (cloudnative-pg#9980 / #9981), which landed in the operator | ||
| # binary in 1.28.2 and needs no CRD change. Upstream publishes a chart only per minor | ||
| # .0/.1, so 1.28.2 has no chart and the fix is unreachable via a chart bump on the 1.28 line. | ||
| # | ||
| # A same-minor pin is #3479-safe: an operator newer than its CRDs is dangerous only when | ||
| # it writes status fields the CRD prunes (e.g. status.instanceID.sessionID, added in CNPG | ||
| # 1.27.3 over 1.27.1 CRDs). Across the 1.28 patch line the backups CRD schema is unchanged | ||
| # (only the controller-gen annotation differs) and the clusters CRD only gains additive | ||
| # spec fields - no new status fields to prune. Any CROSS-minor bump must instead raise the | ||
| # chart version in the Makefile so the operator and CRDs advance together. | ||
| image: | ||
| tag: "1.28.2" |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
🧩 Analysis chain
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
chart="packages/system/postgres-operator/charts/cloudnative-pg/Chart.yaml"
values="packages/system/postgres-operator/values.yaml"
chart_dir="packages/system/postgres-operator/charts/cloudnative-pg"
chart_version="$(sed -nE 's/^version:[[:space:]]*"?([^"]+)"?$/\1/p' "$chart" | head -n1)"
app_version="$(sed -nE 's/^appVersion:[[:space:]]*"?([^"]+)"?$/\1/p' "$chart" | head -n1)"
printf 'chart=%s appVersion=%s\n' "$chart_version" "$app_version"
rg -n -A14 '^cloudnative-pg:' "$values"
test "$chart_version" = "0.28.3"
test "$app_version" = "1.29.1"
if rg -n '^[[:space:]]+tag:[[:space:]]*"1\.28\.2"' "$values"; then
echo "unexpected CloudNativePG 1.28.2 image override" >&2
exit 1
fi
rg -n 'instanceID|sessionID|FileSystemResizePending' "$chart_dir" || trueRepository: cozystack/cozystack
Length of output: 1177
🌐 Web query:
cloudnative-pg charts v0.28.3 Chart.yaml appVersion
💡 Result:
In the cloudnative-pg Helm chart version 0.28.3, the appVersion defined in Chart.yaml is 1.29.1 [1]. This is confirmed by external technical documentation tracking the relationship between CNPG chart versions and their corresponding operator versions [1].
Citations:
🌐 Web query:
raw.githubusercontent.com cloudnative-pg charts cloudnative-pg-v0.28.3 Chart.yaml imageTag appVersion
💡 Result:
In the CloudNativePG Helm chart version 0.28.3, the appVersion defined in Chart.yaml is 1.29.0 [1]. By default, the Helm chart uses this appVersion as the image tag for the CloudNativePG operator container [2]. If a custom image tag is required, it can be overridden in the values.yaml file by setting the image.tag field, which defaults to an empty string (meaning it follows the appVersion) [2].
Citations:
- 1: https://github.com/cloudnative-pg/charts/blob/dbe2b55c/charts/cloudnative-pg/Chart.yaml
- 2: https://artifacthub.io/packages/helm/cloudnative-pg/cloudnative-pg
🌐 Web query:
raw.githubusercontent.com cloudnative-pg/charts cloudnative-pg-v0.28.3 Chart.yaml cloudnative-pg Chart.yaml 0.28.3
💡 Result:
The CloudNativePG Helm chart version 0.28.3 was officially released on June 10, 2026 [1][2][3]. This release is part of the cloudnative-pg/charts repository [1][4]. The Chart.yaml file for this specific version defines the Helm chart metadata for the CloudNativePG operator [1][3]. Key details for the 0.28.3 release include: - Release Date: June 10, 2026 [1][2][3]. - Chart Version: 0.28.3 [1][3]. - Repository: https://github.com/cloudnative-pg/charts [1][4]. - Requirements: The chart requires Kubernetes version >=1.29.0-0 [5][3]. - Purpose: It is used to install the CloudNativePG operator, which manages PostgreSQL workloads on Kubernetes [3][6]. The Chart.yaml file typically contains fields such as apiVersion (v2), name (cloudnative-pg), description (CloudNativePG Operator Helm Chart), and appVersion (which tracks the operator application version) [5]. This release can be found in the official CloudNativePG Helm repository [6] and is mirrored by various third-party platforms [3][7][8].
Citations:
- 1: https://github.com/cloudnative-pg/charts/releases/tag/cloudnative-pg-v0.28.3
- 2: Release cloudnative-pg-v0.28.3 cloudnative-pg/charts#907
- 3: https://artifacthub.io/packages/helm/cloudnative-pg/cloudnative-pg
- 4: https://github.com/cloudnative-pg/charts
- 5: https://github.com/cloudnative-pg/charts/blob/dbe2b55c/charts/cloudnative-pg/Chart.yaml
- 6: https://cloudnative-pg.io/charts/
- 7: rancher/partner-charts@50a716b
- 8: https://github.com/pgEdge/pgedge-cnpg-dist/blob/refs/heads/main/README.md
🏁 Script executed:
#!/usr/bin/env bash
set -u
chart="packages/system/postgres-operator/charts/cloudnative-pg/Chart.yaml"
values="packages/system/postgres-operator/values.yaml"
printf 'Chart metadata:\n'
sed -n '1,40p' "$chart"
printf '\nRelevant values.yaml section:\n'
sed -n '1,40p' "$values"
printf '\nSearch chart override template references:\n'
rg -n "image\.tag|AppVersion|cloudnative-pg" packages/system/postgres-operator -g '*.yaml' -g '*.yml' -g 'templates/**'Repository: cozystack/cozystack
Length of output: 15772
Keep the CloudNativePG operator image aligned with the vendored CRDs.
values.yaml sets cloudnative-pg.image.tag to 1.28.2, but the local chart is still 0.27.1 with appVersion: 1.28.1. That deploys the 1.28.2 operator image with the 1.28.1 CRD set and does not satisfy the target chart/image pair.
Bring the vendored chart to 0.28.3 with appVersion: 1.29.1, then remove the image.tag override and its same-minor compatibility comments. If this intermediate stack must stay, add a guard that prevents deployment while cloudnative-pg.image.tag differs from charts/cloudnative-pg/Chart.yaml.appVersion.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/system/postgres-operator/values.yaml` around lines 4 - 16, Update
the vendored CloudNativePG chart metadata to chart version 0.28.3 with
appVersion 1.29.1, then remove the cloudnative-pg.image.tag override and its
associated same-minor compatibility comments from values.yaml. Ensure the
deployment uses the chart’s appVersion without introducing a mismatched image
tag.
Source: MCP tools
…C resize-deadlock fix Raises the CloudNativePG operator image and its CRDs together to 1.28.2, which carries the PVC resize-deadlock fix (cloudnative-pg#9980 / #9981): after a simultaneous resources+size change the operator deletes the sole primary Pod, leaves the PVC in the resizing class, and never recreates the Pod, wedging the cluster. Upstream publishes a chart only per minor .0/.1, so there is no 1.28.2 chart on the 1.28 line. Following #3526/#3528, patches/cloudnative-pg-1.28.2.patch (applied by make update) raises the vendored chart's appVersion and CRDs from 1.28.1 to 1.28.2 in lockstep; the operator image follows appVersion, so no image.tag pin. Verified #3479-safe: no CRD status field changes between 1.28.1 and 1.28.2 (only the extensions spec grows). Backportable to release-1.6. Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
443df4b to
bcb3626
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/system/postgres-operator/Makefile`:
- Line 15: Remove the local patch application from the Makefile update workflow,
specifically the command applying cloudnative-pg-1.28.2.patch, so vendored chart
files remain verbatim. Use a supported upstream chart instead, or relocate
locally generated chart changes outside packages/**/charts/**; retain the
current workflow only after obtaining an explicit exception.
In `@packages/system/postgres-operator/tests/cnpg-version_test.yaml`:
- Around line 31-38: Update the CRD assertions in the test to select Cluster,
ImageCatalog, and ClusterImageCatalog by metadata.name rather than relying on
documentIndex. For each resource, assert a schema field added by the extensions,
including extensions, bin_path, or env, and verify that the extension image
field is not required where the patch removes that requirement; remove the
unchanged Backup status assertion.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 96617017-3143-4fdb-b376-9e63c4ee1c60
📒 Files selected for processing (6)
packages/system/postgres-operator/Makefilepackages/system/postgres-operator/charts/cloudnative-pg/Chart.yamlpackages/system/postgres-operator/charts/cloudnative-pg/templates/crds/crds.yamlpackages/system/postgres-operator/patches/cloudnative-pg-1.28.2.patchpackages/system/postgres-operator/tests/cnpg-version_test.yamlpackages/system/postgres-operator/values.yaml
| helm repo update cnpg | ||
| helm pull cnpg/cloudnative-pg --untar --untardir charts --version 0.27.1 | ||
| rm -rf charts/cloudnative-pg/charts | ||
| patch --no-backup-if-mismatch -p4 < patches/cloudnative-pg-1.28.2.patch |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy lift
Do not rewrite the vendored chart during make update.
Line 15 applies a local patch that changes charts/cloudnative-pg/Chart.yaml and charts/cloudnative-pg/templates/crds/crds.yaml. The vendored tree will no longer remain verbatim after make update.
Use an upstream chart or move locally owned chart generation outside packages/**/charts/**. If no supported alternative exists, obtain an explicit exception before retaining this workflow.
As per coding guidelines, files under packages/**/charts/** must remain verbatim and must not be edited directly.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/system/postgres-operator/Makefile` at line 15, Remove the local
patch application from the Makefile update workflow, specifically the command
applying cloudnative-pg-1.28.2.patch, so vendored chart files remain verbatim.
Use a supported upstream chart instead, or relocate locally generated chart
changes outside packages/**/charts/**; retain the current workflow only after
obtaining an explicit exception.
Source: Coding guidelines
| - documentIndex: 0 | ||
| equal: | ||
| path: metadata.annotations["controller-gen.kubebuilder.io/version"] | ||
| value: v0.20.1 | ||
| - documentIndex: 0 | ||
| equal: | ||
| path: spec.versions[0].schema.openAPIV3Schema.properties.status.properties.instanceID.properties.sessionID.type | ||
| value: string |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
Assert the extension schemas that this patch adds.
documentIndex: 0 selects the Backup CRD. This patch changes that document only through its controller-gen annotation. The assertion at Line 37 checks an unchanged status field. It does not inspect any new extensions, bin_path, env, or optional image schema.
Select Cluster, ImageCatalog, and ClusterImageCatalog by name. Assert at least one added schema field in each. Also assert that the extension image field is optional where this patch removes that requirement.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/system/postgres-operator/tests/cnpg-version_test.yaml` around lines
31 - 38, Update the CRD assertions in the test to select Cluster, ImageCatalog,
and ClusterImageCatalog by metadata.name rather than relying on documentIndex.
For each resource, assert a schema field added by the extensions, including
extensions, bin_path, or env, and verify that the extension image field is not
required where the patch removes that requirement; remove the unchanged Backup
status assertion.
myasnikovdaniil
left a comment
There was a problem hiding this comment.
LGTM — the patch reproduces upstream 1.28.2 exactly, with no CRD/status skew.
Business context: single-instance Postgres clusters wedge with zero instances after a simultaneous resources+size change, because CNPG ≤1.28.1 classifies a FileSystemResizePending PVC as resizing even with no pod attached and so never recreates the primary.
What I checked: replaying make update (pristine chart 0.27.1 + the patch) yields a vendored tree byte-identical to this branch, and the result matches the official cnpg-1.28.2.yaml release manifest across all 10 CRDs, controller-gen v0.20.1 included. The #3479-safety claim holds — zero status field deltas 1.28.1 → 1.28.2, and every schema change is additive or relaxing (extensions.items.required drops image, bin_path/env added, extensions added to both ImageCatalog CRDs). Nothing else needed porting: the only non-CRD delta between the two upstream manifests is the image tag and the OPERATOR_IMAGE_NAME env that mirrors it — no RBAC, webhook or ConfigMap changes — so the 0.27.1 chart templates stay sufficient. The premise holds too: chart line 0.27.x ends at 0.27.1 (appVersion 1.28.1) and the next chart, 0.28.0, jumps to 1.29.0. tests/cnpg-version_test.yaml is mutation-proven in both directions: reverting only the CRDs fails it, and so does reverting only appVersion.
One aside — 1.28.2 also changes the operator's default PostgreSQL image to 18.3. Inert here, since every Cluster the platform renders pins imageName explicitly.
Two non-blocking follow-ups:
values.yaml:17still says nativebarmanObjectStoreis "removed in 1.29", and this is the release that invalidates it — 1.28.2's own notes move the removal to 1.30.0 (cloudnative-pg#10167). The same claim sits in seven other files, so a repo-wide sweep can be separate, but the line in the file you are already touching is worth correcting.- The CRD half of the new test asserts the
controller-genannotation as a proxy for the 1.28.2 schema, so a regenerated patch that got the annotation right and the schema wrong would still pass. One direct assertion — e.g.spec.postgresql.extensions.items.properties.bin_pathon theclustersCRD — closes that. Keep thestatus.instanceID.sessionIDassertion; it is the #3479 skew canary.
|
Successfully created backport PR for |
|
Created backport PR for
Please cherry-pick the changes locally and resolve any conflicts. git fetch origin backport-3510-to-release-1.5
git worktree add --checkout .worktree/backport-3510-to-release-1.5 backport-3510-to-release-1.5
cd .worktree/backport-3510-to-release-1.5
git reset --hard HEAD^
git cherry-pick -x bcb36262efa9f32e472d063871cf1e8af17f88e9
git push --force-with-lease |
What this PR does
Raises the CloudNativePG operator image and its CRDs together to 1.28.2, which carries the PVC resize-deadlock fix (cloudnative-pg#9980 / cloudnative-pg#9981). Symptom: after a simultaneous
resources+sizechange on a single-instance Postgres, the operator deletes the sole primary Pod, classifies the PVC asresizing, and never recreates the Pod — the cluster wedges with zero instances and the disk FS resize never completes.Upstream publishes a CloudNativePG chart only per minor (
.0/.1), so there is no 1.28.2 chart on the 1.28 line. Following the pattern of #3526 / #3528,patches/cloudnative-pg-1.28.2.patch(applied bymake update) raises the vendored chart'sappVersionand CRDs from 1.28.1 to 1.28.2 in lockstep. The operator image followsappVersion, so there is noimage.tagpin (keeping operator and CRDs aligned and avoiding #3479).Verified #3479-safe: there are no CRD
statusfield changes between 1.28.1 and 1.28.2 — only theextensionsspec grows. Backportable to release-1.6 as-is (same 0.27.1 base chart).Release note
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Tests