mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-09-30 17:30:33 +02:00
Don't panic if Service for the role was not found (#451)
This commit is contained in:
committed by
Sergey Dudoladov
parent
1109c861fb
commit
8330905ce7
@@ -437,7 +437,11 @@ func (c *Cluster) updateService(role PostgresRole, newService *v1.Service) error
|
||||
func (c *Cluster) deleteService(role PostgresRole) error {
|
||||
c.logger.Debugf("deleting service %s", role)
|
||||
|
||||
service := c.Services[role]
|
||||
service, ok := c.Services[role]
|
||||
if !ok {
|
||||
c.logger.Debugf("No service for %s role was found, nothing to delete", role)
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := c.KubeClient.Services(service.Namespace).Delete(service.Name, c.deleteOptions); err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user