mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-09-30 20:02:14 +02:00
Implement replicaLoadBalancer boolean flag. (#38)
The flag adds a replica service with the name cluster_name-repl and
a DNS name that defaults to {cluster}-repl.{team}.{hostedzone}.
The implementation converted Service field of the cluster into a map
with one or two elements and deals with the cases when the new flag
is changed on a running cluster
(the update and the sync should create or delete the replica service).
In order to pick up master and replica service and master endpoint
when listing cluster resources.
* Update the spec when updating the cluster.
This commit is contained in:
@@ -62,7 +62,7 @@ func (c *Controller) podAdd(obj interface{}) {
|
||||
}
|
||||
|
||||
podEvent := spec.PodEvent{
|
||||
ClusterName: c.PodClusterName(pod),
|
||||
ClusterName: c.podClusterName(pod),
|
||||
PodName: util.NameFromMeta(pod.ObjectMeta),
|
||||
CurPod: pod,
|
||||
EventType: spec.EventAdd,
|
||||
@@ -84,7 +84,7 @@ func (c *Controller) podUpdate(prev, cur interface{}) {
|
||||
}
|
||||
|
||||
podEvent := spec.PodEvent{
|
||||
ClusterName: c.PodClusterName(curPod),
|
||||
ClusterName: c.podClusterName(curPod),
|
||||
PodName: util.NameFromMeta(curPod.ObjectMeta),
|
||||
PrevPod: prevPod,
|
||||
CurPod: curPod,
|
||||
@@ -102,7 +102,7 @@ func (c *Controller) podDelete(obj interface{}) {
|
||||
}
|
||||
|
||||
podEvent := spec.PodEvent{
|
||||
ClusterName: c.PodClusterName(pod),
|
||||
ClusterName: c.podClusterName(pod),
|
||||
PodName: util.NameFromMeta(pod.ObjectMeta),
|
||||
CurPod: pod,
|
||||
EventType: spec.EventDelete,
|
||||
|
||||
@@ -115,7 +115,7 @@ Users:
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (c *Controller) PodClusterName(pod *v1.Pod) spec.NamespacedName {
|
||||
func (c *Controller) podClusterName(pod *v1.Pod) spec.NamespacedName {
|
||||
if name, ok := pod.Labels[c.opConfig.ClusterNameLabel]; ok {
|
||||
return spec.NamespacedName{
|
||||
Namespace: pod.Namespace,
|
||||
|
||||
Reference in New Issue
Block a user