-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Right now it is not possible to delete an existing cluster and then create a new one with the same name. When stumbling upon the "/initialize" key from the previous cluster, a Patroni node decide to become a replica of an existing cluster instead of running initidb. Patroni does not delete all objects it creates, namely, non-expiring keys in the DCS, for instance, /initialize. There is simply no good point in the Patroni lifecycle to do this.
Therefore, the operator should take care of deleting those keys: it knows the intention of the user to delete the cluster and it can do this after all Patroni nodes are shut down.
The difficulty is the variety of DCS implementations supported by Patroni (Etcd, Consul, Zookeeper, Kubernetes) and the operator would have to know of all of them. So, as a first step, we can make sure we delete old endpoints created when running in Kubernetes. For the rest of the DCSs, it would be good to come up with a more generic solution that doesn't hard-code the knowledge about how to delete the keys stored there in the operator.