postgres-operator/pkg/cluster
Thomas Rosenstein 9ca87d9db4 Fix deletion timestamp handling for clusters with finalizers
When a Postgres cluster has a finalizer, deleting it sets a DeletionTimestamp
but doesn't remove the object until the finalizer is cleared. The operator
was not properly handling these DeletionTimestamp changes:

1. postgresqlUpdate() was filtering out events where only DeletionTimestamp
   changed (it only checked Spec and Annotations), causing the delete to
   never be processed.

2. EventUpdate case in processEvent() didn't check for DeletionTimestamp,
   so even if the event reached the processor, it would run Update() instead
   of Delete().

3. removeFinalizer() used a cached object with stale resourceVersion,
   causing "object has been modified" errors.

Fixes:
- Add explicit DeletionTimestamp check in postgresqlUpdate() to queue the event
- Add DeletionTimestamp check in EventUpdate to call Delete() when set
- Fetch latest object from API before removing finalizer to avoid conflicts
2025-12-14 20:29:01 +01:00
..
cluster.go Fix deletion timestamp handling for clusters with finalizers 2025-12-14 20:29:01 +01:00
cluster_test.go fix switchover schedule tests (#2995) 2025-12-11 10:22:40 +01:00
connection_pooler.go Ensure podAnnotations are removed from pods if reset in the config (#2826) 2025-01-24 16:53:14 +01:00
connection_pooler_new_test.go Connection pooler for replica (#1127) 2020-11-13 14:52:21 +01:00
connection_pooler_test.go reflect linter feedback, remove unused argumnents and redundant type from arrays (#2739) 2024-08-27 17:56:07 +02:00
database.go stop retention user cleanup early again when DB connection attempt fails (#2999) 2025-12-10 10:01:07 +01:00
exec.go fix golangci-lint issues (#2715) 2024-08-14 12:54:44 +02:00
filesystems.go reflect change in github url (#496) 2019-02-25 11:26:55 +01:00
k8sres.go Fix Sidecar without image specification issue (#2977) 2025-12-09 09:37:11 +01:00
k8sres_test.go Fix Sidecar without image specification issue (#2977) 2025-12-09 09:37:11 +01:00
majorversionupgrade.go bump to v1.15.0 (#2965) 2025-10-21 11:56:33 +02:00
pod.go bump dependencies and reflect linter suggestions (#2963) 2025-10-16 10:23:36 +02:00
pod_test.go fix switch over candidate retrieving (#2760) 2024-11-01 17:06:20 +01:00
resources.go bump dependencies and reflect linter suggestions (#2963) 2025-10-16 10:23:36 +02:00
streams.go do not remove publications of slot defined in manifest (#2868) 2025-02-26 17:31:37 +01:00
streams_test.go fix flaky comparison unit test of retruned errors (#2822) 2024-12-19 17:35:01 +01:00
sync.go stop retention user cleanup early again when DB connection attempt fails (#2999) 2025-12-10 10:01:07 +01:00
sync_test.go stop retention user cleanup early again when DB connection attempt fails (#2999) 2025-12-10 10:01:07 +01:00
types.go Critical operation PDB (#2830) 2025-01-29 12:41:08 +01:00
util.go upgrade Go from 1.23.4 to 1.25.0 (#2945) 2025-08-19 14:40:39 +02:00
util_test.go do not remove publications of slot defined in manifest (#2868) 2025-02-26 17:31:37 +01:00
volumes.go upgrade Go from 1.23.4 to 1.25.0 (#2945) 2025-08-19 14:40:39 +02:00
volumes_test.go Add support for EBS CSI Driver (#2677) 2024-12-19 12:32:09 +01:00