nullify service and endpoint before recreation

This commit is contained in:
Felix Kunde 2019-11-12 17:45:10 +01:00
parent dfb9b68baf
commit bbb424dc2d
1 changed files with 2 additions and 3 deletions

View File

@ -380,8 +380,6 @@ func (c *Cluster) updateService(role PostgresRole, newService *v1.Service) error
return fmt.Errorf("could not delete service %q: %v", serviceName, err)
}
// make sure we clear the stored service status if the subsequent create fails.
c.Services[role] = nil
// wait until the service is truly deleted
c.logger.Debugf("waiting for service to be deleted")
@ -395,7 +393,8 @@ func (c *Cluster) updateService(role PostgresRole, newService *v1.Service) error
return fmt.Errorf("could not delete service %q: %v", serviceName, err)
}
// make sure we clear the stored endpoint status if the subsequent create fails.
// make sure we clear the stored service and endpoint status if the subsequent create fails.
c.Services[role] = nil
c.Endpoints[role] = nil
if role == Master {
// create the new endpoint using the addresses obtained from the previous one