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:
		
							parent
							
								
									8f08bef67c
								
							
						
					
					
						commit
						37caa3f60b
					
				|  | @ -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) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue