sync PDB also on update
This commit is contained in:
parent
f1dae6e8ef
commit
b99567415b
|
|
@ -579,6 +579,15 @@ func (c *Cluster) Update(oldSpec, newSpec *acidv1.Postgresql) error {
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
// pod disruption budget
|
||||||
|
if oldSpec.Spec.NumberOfInstances != newSpec.Spec.NumberOfInstances {
|
||||||
|
c.logger.Debug("syncing pod disruption budgets")
|
||||||
|
if err := c.syncPodDisruptionBudget(true); err != nil {
|
||||||
|
c.logger.Errorf("could not sync pod disruption budget: %v", err)
|
||||||
|
updateFailed = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// logical backup job
|
// logical backup job
|
||||||
func() {
|
func() {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,20 +73,6 @@ func (c *Cluster) Sync(newSpec *acidv1.Postgresql) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// create database objects unless we are running without pods or disabled that feature explicitly
|
|
||||||
if !(c.databaseAccessDisabled() || c.getNumberOfInstances(&newSpec.Spec) <= 0) {
|
|
||||||
c.logger.Debugf("syncing roles")
|
|
||||||
if err = c.syncRoles(); err != nil {
|
|
||||||
err = fmt.Errorf("could not sync roles: %v", err)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
c.logger.Debugf("syncing databases")
|
|
||||||
if err = c.syncDatabases(); err != nil {
|
|
||||||
err = fmt.Errorf("could not sync databases: %v", err)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
c.logger.Debug("syncing pod disruption budgets")
|
c.logger.Debug("syncing pod disruption budgets")
|
||||||
if err = c.syncPodDisruptionBudget(false); err != nil {
|
if err = c.syncPodDisruptionBudget(false); err != nil {
|
||||||
err = fmt.Errorf("could not sync pod disruption budget: %v", err)
|
err = fmt.Errorf("could not sync pod disruption budget: %v", err)
|
||||||
|
|
@ -103,6 +89,20 @@ func (c *Cluster) Sync(newSpec *acidv1.Postgresql) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// create database objects unless we are running without pods or disabled that feature explicitly
|
||||||
|
if !(c.databaseAccessDisabled() || c.getNumberOfInstances(&newSpec.Spec) <= 0) {
|
||||||
|
c.logger.Debugf("syncing roles")
|
||||||
|
if err = c.syncRoles(); err != nil {
|
||||||
|
err = fmt.Errorf("could not sync roles: %v", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
c.logger.Debugf("syncing databases")
|
||||||
|
if err = c.syncDatabases(); err != nil {
|
||||||
|
err = fmt.Errorf("could not sync databases: %v", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ func SamePDB(cur, new *policybeta1.PodDisruptionBudget) (match bool, reason stri
|
||||||
//TODO: improve comparison
|
//TODO: improve comparison
|
||||||
match = reflect.DeepEqual(new.Spec, cur.Spec)
|
match = reflect.DeepEqual(new.Spec, cur.Spec)
|
||||||
if !match {
|
if !match {
|
||||||
reason = "new service spec doesn't match the current one"
|
reason = "new PDB spec doesn't match the current one"
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue