[Bug]: enablePDB=false deletes independently managed PDBs with matching names
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 84/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- go, kubernetes, postgresql
- Ambito
- databases, infrastructure
Direzione di ricerca
Inizia in internal/controller/cluster_create.go, in deletePodDisruptionBudgetIfExists, e verifica come i builder di PDB impostano la proprietà del controller. Riproduci il comportamento con i manifest Cluster e PDB forniti, quindi verifica che la pulizia rimuova i budget controllati da CNPG lasciando intatto un PDB gestito indipendentemente con lo stesso nome.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Go
- Stelle
- 9.7k
- Fork
- 826
- Merge medio
- 2g 1h
- PR unite (30g)
- 122
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di cloudnative-pg/cloudnative-pg
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
cloudnative-pg/cloudnative-pg#12059 · 3 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
[Docs]: Document the egress traffic that instance pods need when a NetworkPolicy restricts egressForse di nuovo libera @fjvbn2003 l’ha presa 13 giorni fa e non c’è nessuna pull request aperta. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
cloudnative-pg/cloudnative-pg#11750 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: A failed plugin backup sets the deprecated `status.lastFailedBackup`, so `cnpg_collector_last_failed_backup_timestamp` stays newer than the last available backupForse di nuovo libera @fjvbn2003 l’ha presa 13 giorni fa e non c’è nessuna pull request aperta. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
cloudnative-pg/cloudnative-pg#11749 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Managed role stays pending-reconciliation when a membership has several grantor rowsForse già presa @MatheuslFavaretto l’ha presa 45 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
cloudnative-pg/cloudnative-pg#11624 · 2 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
cloudnative-pg/cloudnative-pg#11587 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di cloudnative-pg/cloudnative-pg
Issue simili
-
[Bug]: Azure SAS signing uses local time instead of UTC, shifting validity window on non-UTC hostsForse già presa @huanghaoyuanhhy l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
zilliztech/milvus-backup#1418 ·
I maintainer di solito rispondono entro 1 giorno
-
good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
eugenioenko/ttt#1909 ·
I maintainer di solito rispondono entro 1 giorno
-
ColumnIndex max truncation returns a value smaller than the real max when the prefix is all 0xFFAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
parquet-go/parquet-go#819 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
-
feat(arithmetization): update `arithmetization` to ZkC version `v1.2.38`Forse già presa @DavePearce l’ha presa oggi. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
LFDT-Lineth/lineth-monorepo#4679 ·
I maintainer di solito rispondono entro 1 giorno