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:
Oleksii Kliukin 2018-04-27 12:35:25 +02:00
parent 8f08bef67c
commit 37caa3f60b
1 changed files with 1 additions and 2 deletions

View File

@ -108,11 +108,10 @@ func (c *Cluster) syncService(role PostgresRole) error {
svc, err := c.KubeClient.Services(c.Namespace).Get(c.serviceName(role), metav1.GetOptions{})
if err == nil {
c.Services[role] = svc
desiredSvc := c.generateService(role, &c.Spec)
match, reason := k8sutil.SameService(svc, desiredSvc)
if match {
c.Services[role] = svc
return nil
}
c.logServiceChanges(role, svc, desiredSvc, false, reason)