mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-17 20:51:40 +02:00
Add patroni_use_kubernetes parameter.
Add a dedicated parameter to enable support for Kubernetes in Patroni instead of relying on a legacy hack of setting etcd_host to an empty string. The latter still works, however, it will show a warning, nudging users to change to the new parameter. For the sake of not breaking existing non-Kubernetes setups, patroni_use_kubernetes has not effect if etcd_host is set to a non-empty value.
This commit is contained in:
@@ -927,7 +927,7 @@ type ClusterObjectDelete func(name string) error
|
||||
|
||||
func (c *Cluster) deletePatroniClusterObjects() error {
|
||||
// TODO: figure out how to remove leftover patroni objects in other cases
|
||||
if !c.patroniUsesKubernetes() {
|
||||
if !c.OpConfig.PatroniUseKubernetes {
|
||||
c.logger.Infof("not cleaning up Etcd Patroni objects on cluster delete")
|
||||
}
|
||||
c.logger.Debugf("removing leftover Patroni objects (endpoints or configmaps)")
|
||||
|
||||
@@ -399,7 +399,7 @@ func (c *Cluster) generatePodTemplate(
|
||||
envVars = append(envVars, v1.EnvVar{Name: "LOG_BUCKET_SCOPE_PREFIX", Value: ""})
|
||||
}
|
||||
|
||||
if c.patroniUsesKubernetes() {
|
||||
if c.OpConfig.PatroniUseKubernetes {
|
||||
envVars = append(envVars, v1.EnvVar{Name: "DCS_ENABLE_KUBERNETES_API", Value: "true"})
|
||||
} else {
|
||||
envVars = append(envVars, v1.EnvVar{Name: "ETCD_HOST", Value: c.OpConfig.EtcdHost})
|
||||
|
||||
@@ -460,7 +460,3 @@ func (c *Cluster) GetSpec() (*spec.Postgresql, error) {
|
||||
defer c.specMu.RUnlock()
|
||||
return cloneSpec(&c.Postgresql)
|
||||
}
|
||||
|
||||
func (c *Cluster) patroniUsesKubernetes() bool {
|
||||
return c.OpConfig.EtcdHost == ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user