Minor fixes around PDB (pod-distruption-budget) syncing: (#147)

- Call comparison function in the case of the sync as well as for update
- Include full cluster name in PDB name
- Assign cluster labels to the PDB object
This commit is contained in:
Oleksii Kliukin
2017-10-23 12:26:59 +02:00
committed by Murat Kabilov
parent c17aabb642
commit 7a76be7d3e
3 changed files with 15 additions and 16 deletions
+3 -7
View File
@@ -536,13 +536,9 @@ func (c *Cluster) Update(newSpec *spec.Postgresql) error {
c.logger.Infof("volumes have been updated successfully")
}
newPDB := c.generatePodDisruptionBudget()
if match, reason := c.samePDBWith(newPDB); !match {
c.logPDBChanges(c.PodDisruptionBudget, newPDB, true, reason)
if err := c.updatePodDisruptionBudget(newPDB); err != nil {
c.setStatus(spec.ClusterStatusUpdateFailed)
return fmt.Errorf("could not update pod disruption budget: %v", err)
}
if err := c.syncPodDisruptionBudget(true); err != nil {
c.setStatus(spec.ClusterStatusUpdateFailed)
return fmt.Errorf("could not update pod disruption budget: %v", err)
}
c.setStatus(spec.ClusterStatusRunning)