mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-17 16:35:51 +02:00
add Pg manifest field
This commit is contained in:
+9
-1
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user