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
Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
* Add topologySpreadConstraints configuration to pod spec.
* Run update-codegen.sh to add deepcopy for new field to the api.
* Reuse configured TopologySpreadConstraints for logical backup.
* Remove x-kubernetes-preserve-unknown-fields and XPreserveUnknownFields.
* Add topologySpreadConstraint example in the complete manifest.
* Add support for helm chart.
* Add documentation for topologySpreadConstraint.
* Update e2e test to patch topologySpreadConstraints into the postgresqls manifest.
* For e2e test, updated the PVC retention policy to remove redundant PVCs.
* Fix e2e test, expected PVC count in end-to-end test after config changes.
* build multi-arch pooler image
* add pooler build step in delivery.yaml and bump pooler version
* pull from docker hub not zalando registry
* add pooler step to ghcr workflow
* pass infra roles to auth file via pooler entrypoint
* introduce extra pooler secret for mounting auth_file
* use pbgouncer as image name and push to ghcr on next merge
* build with latest pgbouncer
* integrate new image in e2e process and update pooler image default
* update pooler build dependencies
* build pooler image for e2e test
* more Makefile and e2e run script tweaking
---------
Co-authored-by: Ida Novindasari <idanovinda@gmail.com>
* add fix to recreate non running pods in syncStatefulsets
* remove TestSyncStatefulSetNonRunningPodsDoNotBlockRecreatio
* revert pod_test
* pod without status
---------
Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
Co-authored-by: Ida Novindasari <idanovinda@gmail.com>
* Add support for pg18 and remove pg13
* Update general spilo image and use new rebuilt e2e spilo image
---------
Co-authored-by: Polina Bungina <polina.bungina@zalando.de>
* Sort postgresql.crd.yaml
* Generate postgresql CRD from go structs
* Expand sidecars, env and initcontainers
* Embed CRD to be submitted by the operator
Signed-off-by: Mikkel Oscar Lyderik Larsen <mikkel.larsen@zalando.de>
---------
Signed-off-by: Mikkel Oscar Lyderik Larsen <mikkel.larsen@zalando.de>
* fix docker build for UI and bumped some outdated versions in docs and config
* update helm chart image again because of wrong format field
* switch to new registry ghcr.io for e2e test
* update e2e test runner Dockerfile
* fix switchover schedule tests
Previously the tests would fail depending on the local time zone and the
time of day the test was being run.
---------
Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
Co-authored-by: Mikkel Oscar Lyderik Larsen <mikkeloscar@users.noreply.github.com>
* skip db user actions when its secret failed to sync on update
* need to add new pgUser field to e2e test
* lets collect errors of syncSecret so we still get status updateFailed
* Replace `golang.org/x/exp` with stdlib
These experimental packages are now available in the Go standard
library since Go 1.21.
1. golang.org/x/exp/slices -> slices [1]
2. golang.org/x/exp/maps -> maps [2]
[1]: https://go.dev/doc/go1.21#slices
[2]: https://go.dev/doc/go1.21#maps
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* Run go mod tidy
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
---------
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
Add service selector comparison to compareServices
This is necessary for the proper switch of `kubernetes_use_configmaps` configuration value, as master service should have different label selector setup for those.
* do not remove publications of slot defined in manifest
* improve condition to sync streams
* init publication tables map when adding manifest slots
* need to update c.Stream when there is no update
Create the second PDB to cover Pods with a special "critical operation" label set.
This label is going to be assigned to all pg cluster's Pods by the Operator during a PG major version upgrade, by Patroni during a cluster/replica bootstrap. It can also be set manually or by any other automation tool.