From 76ea754fc3e00fea81803ee740412b58f18f3ef0 Mon Sep 17 00:00:00 2001 From: Oleksii Kliukin Date: Thu, 24 May 2018 11:17:42 +0200 Subject: [PATCH] Be lenient when asked to shrink a persisten volume. Do not hard error, emit a warning instead. The cluster is not going to be broken because of our refusal to shrink a volume. --- pkg/cluster/volumes.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/cluster/volumes.go b/pkg/cluster/volumes.go index 42b5858fc..6f539f4ee 100644 --- a/pkg/cluster/volumes.go +++ b/pkg/cluster/volumes.go @@ -103,10 +103,10 @@ func (c *Cluster) resizeVolumes(newVolume spec.Volume, resizers []volumes.Volume for _, pv := range pvs { volumeSize := quantityToGigabyte(pv.Spec.Capacity[v1.ResourceStorage]) - if volumeSize > newSize { - return fmt.Errorf("cannot shrink persistent volume") - } - if volumeSize == newSize { + if volumeSize >= newSize { + if volumeSize > newSize { + c.logger.Warningf("cannot shrink persistent volume") + } continue } for _, resizer := range resizers {