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()
// the last pvc stays until the cluster is explicitly deleted as opposed to being scaled down to 0 pods
// 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 {
c.deleteUnusedPersistentVolumeClaims()
}

View File

@ -57,14 +57,14 @@ func (c *Cluster) deleteUnusedPersistentVolumeClaims() {
c.logger.Debug("deleting pvc of shut down pods")
// 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
// Scaling down to 0 replicas is not cluster deletion so keep the last PVC
// Operator removes it only when explicit "kubectl pg delete" is issued
if c.getNumberOfInstances(&c.Spec) == 0 {
c.logger.Info("cluster scaled down to 0 pods; skipping deletion of the last pvc")
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++ {
podIndex := strconv.Itoa(int(i))
pvcName := "pgdata-" + c.Name + "-" + podIndex