add Pg manifest field

This commit is contained in:
Sergey Dudoladov
2020-04-30 10:31:58 +02:00
parent 359f843909
commit 87af0a1271
11 changed files with 49 additions and 52 deletions
+9 -1
View File
@@ -118,7 +118,7 @@ func (c *Cluster) Sync(newSpec *acidv1.Postgresql) error {
// remove PVCs of shut down pods
// the last PVC stays until the cluster is explicitly deleted as opposed to scaled down to 0 pods
if c.OpConfig.EnableUnusedPVCDeletion && c.getNumberOfInstances(&c.Spec) > 0 {
if c.mustEnableUnusedPvcDeletion() && c.getNumberOfInstances(&c.Spec) > 0 {
c.deleteUnusedPersistentVolumeClaims()
}
@@ -130,6 +130,14 @@ func (c *Cluster) Sync(newSpec *acidv1.Postgresql) error {
return err
}
func (c *Cluster) mustEnableUnusedPvcDeletion() bool {
if c.Spec.EnableUnusedPVCDeletion != nil {
return *c.Spec.EnableUnusedPVCDeletion
}
return c.OpConfig.EnableUnusedPVCDeletion
}
func (c *Cluster) syncServices() error {
for _, role := range []PostgresRole{Master, Replica} {
c.logger.Debugf("syncing %s service", role)