diff --git a/pkg/cluster/cluster.go b/pkg/cluster/cluster.go index 119237976..9bc236763 100644 --- a/pkg/cluster/cluster.go +++ b/pkg/cluster/cluster.go @@ -231,6 +231,12 @@ func (c *Cluster) Create() error { } c.logger.Infof("secrets have been successfully created") + pdb, err := c.createPodDisruptionBudget() + if err != nil { + return fmt.Errorf("could not create pod disruption budget: %v", err) + } + c.logger.Infof("pod disruption budget %q has been successfully created", util.NameFromMeta(pdb.ObjectMeta)) + ss, err = c.createStatefulSet() if err != nil { return fmt.Errorf("could not create statefulset: %v", err) @@ -261,12 +267,6 @@ func (c *Cluster) Create() error { } } - pdb, err := c.createPodDisruptionBudget() - if err != nil { - return fmt.Errorf("could not create pod disruption budget: %v", err) - } - c.logger.Infof("pod disruption budget %q has been successfully created", util.NameFromMeta(pdb.ObjectMeta)) - err = c.listResources() if err != nil { c.logger.Errorf("could not list resources: %v", err) diff --git a/pkg/cluster/sync.go b/pkg/cluster/sync.go index dd232cff8..be5760c74 100644 --- a/pkg/cluster/sync.go +++ b/pkg/cluster/sync.go @@ -278,6 +278,11 @@ func (c *Cluster) syncVolumes() error { } func (c *Cluster) samePDBWith(pdb *policybeta1.PodDisruptionBudget) (match bool, reason string) { + if c.PodDisruptionBudget == nil { + match = false + reason = "pdb does not exist" + return + } match = reflect.DeepEqual(pdb.Spec, c.PodDisruptionBudget.Spec) if !match { reason = "new service spec doesn't match the current one"