zalando / postgres-operator

Postgres operator creates and manages PostgreSQL clusters running in Kubernetes
https://postgres-operator.readthedocs.io/
MIT License
4.38k stars 980 forks source link

fix stream duplication on operator restart #2733

Closed FxKu closed 3 months ago

FxKu commented 3 months ago

With the refactoring in #2713 I removed one important part of syncing the streams: Fetching the current state from K8s API. Instead I looped over the new cluster struct field Streams which is always empty on start up. This will produce a new stream resource on ever operator pod start. Therefore, I added a delete logic to cleanup the ill-created duplicates.

The unit tests were extended to test syncing and removal as well as owner references update.

idanovinda commented 3 months ago

👍

FxKu commented 3 months ago

:+1: