mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-18 10:29:50 +02:00
Fix a bug with syncing services
Avoid showing "there is no service in the cluster" when syncing a service for the cluster if the operator has been restarted after the cluster had been created.
This commit is contained in:
+1
-2
@@ -108,11 +108,10 @@ func (c *Cluster) syncService(role PostgresRole) error {
|
|||||||
|
|
||||||
svc, err := c.KubeClient.Services(c.Namespace).Get(c.serviceName(role), metav1.GetOptions{})
|
svc, err := c.KubeClient.Services(c.Namespace).Get(c.serviceName(role), metav1.GetOptions{})
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
c.Services[role] = svc
|
||||||
desiredSvc := c.generateService(role, &c.Spec)
|
desiredSvc := c.generateService(role, &c.Spec)
|
||||||
match, reason := k8sutil.SameService(svc, desiredSvc)
|
match, reason := k8sutil.SameService(svc, desiredSvc)
|
||||||
if match {
|
if match {
|
||||||
c.Services[role] = svc
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
c.logServiceChanges(role, svc, desiredSvc, false, reason)
|
c.logServiceChanges(role, svc, desiredSvc, false, reason)
|
||||||
|
|||||||
Reference in New Issue
Block a user