fix comments

This commit is contained in:
Sergey Dudoladov 2020-04-15 10:05:59 +02:00
parent 5fa3885519
commit 7032582130
2 changed files with 5 additions and 5 deletions

View File

@ -110,8 +110,8 @@ func (c *Cluster) Sync(newSpec *acidv1.Postgresql) error {
} }
} }
// remove unused PVCs in case deleting them during scale down failed; see Update() // remove PVCs of shut down pods
// the last pvc stays until the cluster is explicitly deleted as opposed to being scaled down to 0 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.OpConfig.EnableUnusedPVCDeletion && c.getNumberOfInstances(&c.Spec) > 0 {
c.deleteUnusedPersistentVolumeClaims() c.deleteUnusedPersistentVolumeClaims()
} }

View File

@ -57,14 +57,14 @@ func (c *Cluster) deleteUnusedPersistentVolumeClaims() {
c.logger.Debug("deleting pvc of shut down pods") c.logger.Debug("deleting pvc of shut down pods")
// Scaling down to 0 replicas is not cluster deletion so keep the last pvc. // Scaling down to 0 replicas is not cluster deletion so keep the last PVC
// Operator will remove it only when explicit "kubectl pg delete" is issued // Operator removes it only when explicit "kubectl pg delete" is issued
if c.getNumberOfInstances(&c.Spec) == 0 { if c.getNumberOfInstances(&c.Spec) == 0 {
c.logger.Info("cluster scaled down to 0 pods; skipping deletion of the last pvc") c.logger.Info("cluster scaled down to 0 pods; skipping deletion of the last pvc")
return return
} }
// XXX that also deletes PVC of pods shut down before this change is deployed // XXX also deletes PVCs of pods shut down before this change is deployed
for i := c.getNumberOfInstances(&c.Spec); ; i++ { for i := c.getNumberOfInstances(&c.Spec); ; i++ {
podIndex := strconv.Itoa(int(i)) podIndex := strconv.Itoa(int(i))
pvcName := "pgdata-" + c.Name + "-" + podIndex pvcName := "pgdata-" + c.Name + "-" + podIndex