[Bug]: enablePDB=false deletes independently managed PDBs with matching names
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 84/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- go, kubernetes, postgresql
調査の方向性
internal/controller/cluster_create.go の deletePodDisruptionBudgetIfExists から始め、PDB ビルダーがどのように controller の所有権を設定しているかを確認します。提供された Cluster マニフェストと PDB マニフェストで動作を再現し、クリーンアップによって CNPG が管理する budget は削除され、同じ名前を持つ独立して管理された PDB はそのまま残ることを検証します。
索引モデルが issue の本文から書いたものです。
説明
Is there an existing issue already for this bug?
- I searched for an existing report and did not find one covering this deletion behavior.
Troubleshooting and supported releases
- I read the troubleshooting and supported-release guidance.
Version
1.30.1. The same deletion path is present on main at 9c8de1b9e1af2b71f74a808c543c7be988d27baf.
Kubernetes version and environment
Kubernetes 1.35.6 on Google GKE. The operator is installed through Helm.
What happened?
With spec.enablePDB: false, the operator deletes an independently managed PDB whose name matches the Cluster name. The custom PDB has no owner references. Argo CD recreates it, then CNPG deletes it again, producing reconciliation churn and gaps in disruption-budget coverage.
The cleanup also targets <cluster-name>-primary. Neither deletion checks whether the PDB is controlled by the Cluster.
Expected: disabling CNPG's built-in PDBs removes its own budgets and leaves independently managed budgets intact.
Minimal reproduction
On a cluster with CNPG installed, apply these resources and observe the PDB and Cluster events:
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: pdb-example
spec:
instances: 2
enablePDB: false
storage:
size: 1Gi
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: pdb-example
spec:
maxUnavailable: 1
selector:
matchLabels:
cnpg.io/cluster: pdb-example
cnpg.io/podRole: instance
The manifests above use an example name. In the affected deployment, the custom PDB's metadata.ownerReferences is absent, but the Cluster receives DeletingPodDisruptionBudget events naming that PDB.
Relevant code
deletePodDisruptionBudgetIfExists gets the PDB by name and deletes it without checking ownership. CNPG's PDB builders already set a controller owner reference to the Cluster.
A small possible fix is to check metav1.IsControlledBy(&targetPdb, cluster) before deleting. This would preserve the existing cleanup for CNPG-owned budgets without introducing another annotation or API setting.
The current workaround is to give the custom PDB a different name.
Contribution
I'd like to work on this. Please confirm whether checking the existing controller owner reference is the preferred approach and assign the issue if appropriate.
This report and proposed approach were prepared with OpenAI Codex assistance and reviewed against the affected deployment and upstream source.
Code of Conduct
- I agree to follow this project's Code of Conduct.
- 主要言語
- Go
- スター
- 9.7k
- フォーク
- 826
- 平均マージ
- 2日 1時間
- マージ済み PR(30日)
- 122
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
cloudnative-pg/cloudnative-pg のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
cloudnative-pg/cloudnative-pg#12059 · コメント 3 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Docs]: Document the egress traffic that instance pods need when a NetworkPolicy restricts egress再び着手できるかも @fjvbn2003 が 13 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
cloudnative-pg/cloudnative-pg#11750 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Bug]: A failed plugin backup sets the deprecated `status.lastFailedBackup`, so `cnpg_collector_last_failed_backup_timestamp` stays newer than the last available backup再び着手できるかも @fjvbn2003 が 13 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
cloudnative-pg/cloudnative-pg#11749 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Managed role stays pending-reconciliation when a membership has several grantor rows対応中かも @MatheuslFavaretto が 45 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
cloudnative-pg/cloudnative-pg#11624 · コメント 2 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
cloudnative-pg/cloudnative-pg#11587 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
cloudnative-pg/cloudnative-pg の issue をすべて見る
似ている issue
-
[Bug]: Azure SAS signing uses local time instead of UTC, shifting validity window on non-UTC hosts対応中かも @huanghaoyuanhhy が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
zilliztech/milvus-backup#1418 ·
メンテナーはふだん 1 日以内に返信
-
good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
eugenioenko/ttt#1909 ·
メンテナーはふだん 1 日以内に返信
-
ColumnIndex max truncation returns a value smaller than the real max when the prefix is all 0xFFオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
parquet-go/parquet-go#819 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
-
feat(arithmetization): update `arithmetization` to ZkC version `v1.2.38`対応中かも @DavePearce が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
LFDT-Lineth/lineth-monorepo#4679 ·
メンテナーはふだん 1 日以内に返信