canonical / postgresql-k8s-operator

A Charmed Operator for running PostgreSQL on Kubernetes
https://charmhub.io/postgresql-k8s
Apache License 2.0
10 stars 20 forks source link

[Backup/Restore] Postgresql wrongly references Endpoint instead of Service in k8s #306

Open phvalguima opened 1 year ago

phvalguima commented 1 year ago

Looking into restore code for kubernetes, I can see in these lines that we must delete patroni-<charm-name>-config endpoint to restore from backup.

However, Patroni coming from latest 14.9, channel=14/edge, does not exist as an endpoint. It exists as a Service. That section should fail during restore process.

github-actions[bot] commented 1 year ago

https://warthogs.atlassian.net/browse/DPE-2849

taurus-forever commented 4 months ago

@marceloneppel I am not sure how backup tests pass (CI and manual) if @phvalguima is right. Should we fix something here?

taurus-forever commented 2 months ago

@phvalguima I have quickly deployed the latest PostgreSQL:

ubuntu@juju350:~$ juju deploy postgresql-k8s --trust --channel 14/edge
Deployed "postgresql-k8s" from charm-hub charm "postgresql-k8s", revision 351 in channel 14/edge on ubuntu@22.04/stable

And I do see both Services and Endpoint patroni-<app>-config:

ubuntu@juju350:~$ kubectl get endpoints -n testisterraform | grep patroni
patroni-postgresql-k8s-config   <none>                            3m14s
patroni-postgresql-k8s-sync     <none>                            3m10s
patroni-postgresql-k8s          <none>                            3m11s

ubuntu@juju350:~$ kubectl get services -n testisterraform | grep patroni
patroni-postgresql-k8s-config   ClusterIP   None             <none>        <none>              3m22s
ubuntu@juju350:~$ 

We are most probably do not use patroni endpoint here, but safety first: on recover let's clean garbage.

The only open question to resolve this GH issue on my side: should we also remove patroni-<app>-sync endpoint here? Otherwise feel free to resolve this issue. CC: @marceloneppel , @dragomirp .