Remove the persistent volume size validation of SGCluster and SGShardedCluster

Summary

The validating webhook of SGCluster and SGShardedCluster rejects any change of the persistent volume size that the operator can not verify itself:

  • decreasing .spec.pods.persistentVolume.size is always rejected with Decrease of persistent volume size is not supported;
  • increasing it is rejected when the StorageClass used by the cluster does not set allowVolumeExpansion: true, or when no StorageClass can be found yet (Cannot increase persistent volume size because we cannot verify if the storage class allows it, try again later).

For SGShardedCluster the same checks apply to .spec.coordinator.pods.persistentVolume.size, .spec.workers.pods.persistentVolume.size (or .spec.shards) and the persistent volume size of the workers and query routers overrides.

Whether a volume can be expanded or shrunk is decided by Kubernetes and the StorageClass implementation, not by the operator, and the size of the SGCluster only changes the volume claim templates of its StatefulSet (the operator recreates the StatefulSet keeping its Pods and PersistentVolumeClaims). The validation forces procedures like the volume downsize runbook to temporarily remove the operator validating webhook.

Proposed resolution

Remove the persistent volume size validators of SGCluster and SGShardedCluster and leave to the StorageClass implementation the check of whether an expansion or a shrink of a persistent volume is possible. Update the storage configuration documentation and the volume downsize runbook accordingly.

Edited by Matteo Melli