Skip to content

Commit

Permalink
Dont mind missing resource references in the Cluster when trying to d…
Browse files Browse the repository at this point in the history
…elete them
  • Loading branch information
frittentheke committed May 5, 2020
1 parent 9bc3d8f commit 8e7c4ed
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/cluster/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,8 @@ func (c *Cluster) deleteStatefulSet() error {
c.setProcessName("deleting statefulset")
c.logger.Debugln("deleting statefulset")
if c.Statefulset == nil {
return fmt.Errorf("there is no statefulset in the cluster")
c.logger.Debugf("there is no statefulset in the cluster")
return nil
}

err := c.KubeClient.StatefulSets(c.Statefulset.Namespace).Delete(context.TODO(), c.Statefulset.Name, c.deleteOptions)
Expand Down Expand Up @@ -681,7 +682,8 @@ func (c *Cluster) updatePodDisruptionBudget(pdb *policybeta1.PodDisruptionBudget
func (c *Cluster) deletePodDisruptionBudget() error {
c.logger.Debug("deleting pod disruption budget")
if c.PodDisruptionBudget == nil {
return fmt.Errorf("there is no pod disruption budget in the cluster")
c.logger.Debugf("there is no pod disruption budget in the cluster")
return nil
}

pdbName := util.NameFromMeta(c.PodDisruptionBudget.ObjectMeta)
Expand Down Expand Up @@ -719,7 +721,8 @@ func (c *Cluster) deleteEndpoint(role PostgresRole) error {
c.setProcessName("deleting endpoint")
c.logger.Debugln("deleting endpoint")
if c.Endpoints[role] == nil {
return fmt.Errorf("there is no %s endpoint in the cluster", role)
c.logger.Debugf("there is no %s endpoint in the cluster", role)
return nil
}

if err := c.KubeClient.Endpoints(c.Endpoints[role].Namespace).Delete(context.TODO(), c.Endpoints[role].Name, c.deleteOptions); err != nil {
Expand Down

0 comments on commit 8e7c4ed

Please sign in to comment.