postgres-operator/pkg/controller
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
..
controller.go Fix deletion timestamp handling for clusters with finalizers 2025-12-14 20:29:01 +01:00
logs_and_api.go deprecate ClusterName field of Postgresql type and remove team from REST endpoints (#2015) 2022-08-29 15:00:25 +02:00
node.go End 2 End tests speedup (#1180) 2020-10-28 10:04:33 +01:00
node_test.go diff SecurityContext of containers (#1255) 2020-12-15 10:06:53 +01:00
operator_config.go bump to v1.15.0 (#2965) 2025-10-21 11:56:33 +02:00
pod.go Move operator to go 1.14 (#882) 2020-03-30 15:50:17 +02:00
postgresql.go Fix deletion timestamp handling for clusters with finalizers 2025-12-14 20:29:01 +01:00
postgresql_test.go allow delete only if annotations meet configured criteria (#1069) 2020-08-13 16:36:22 +02:00
types.go Bootstrapped databases with best practice role setup (#843) 2020-04-29 10:56:06 +02: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 reflect linter feedback, remove unused argumnents and redundant type from arrays (#2739) 2024-08-27 17:56:07 +02:00