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.
This commit is contained in:
Oleksii Kliukin 2018-05-24 11:17:42 +02:00
parent 1ea8b3bbe6
commit 76ea754fc3
1 changed files with 4 additions and 4 deletions

View File

@ -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 {