Resizing data volumes
Resizing a volume on K8s work like a charm, in the documentation said that in k8s 1.15 was in beta the option `ExpandInUsePersistentVolumes` this will allow the resize without restarting or recreating the pod. Seems that in k8s 1.16 was included already and resizing a volumen containing a filesystem is only allow it with XFS, Ext3, or Ext4 .
Testing in EKS, with k8s `1.17` and SG `0.9.3` with a cluster with 20GB volumes:
```
$kubectl edit pvc -n ongres-db ongres-db-data-ongres-db-2
set:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 30Gi
```
pod-1:
```
kubectl edit pvc -n ongres-db ongres-db-data-ongres-db-1
set:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 35Gi
```
The PVC's:
```
$ kubectl get pvc -n ongres-db
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
distributedlogs-data-distributedlogs-0 Bound pvc-e353953a-ffc5-4a5d-abeb-4a2abccaf837 50Gi RWO gp2 53m
ongres-db-data-ongres-db-0 Bound pvc-735f3598-1bdc-4816-9bee-98a34a31dabf 20Gi RWO gp2-data 31m
ongres-db-data-ongres-db-1 Bound pvc-775c3151-a21a-47f2-9a3f-f2bf8f7b4987 35Gi RWO gp2-data 30m
ongres-db-data-ongres-db-2 Bound pvc-babd20c5-4faa-41bc-a9e9-25061a7aca69 30Gi RWO gp2-data 30m
```
and checking in the pod:
```
$ kubectl exec -it -n ongres-db ongres-db-1 -c patroni -- df -h
Filesystem Size Used Avail Use% Mounted on
overlay 100G 4.2G 96G 5% /
tmpfs 64M 0 64M 0% /dev
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/nvme0n1p1 100G 4.2G 96G 5% /etc/group
tmpfs 3.9G 8.0K 3.9G 1% /dev/shm
tmpfs 3.9G 4.0K 3.9G 1% /run/postgresql
/dev/nvme1n1 35G 144M 35G 1% /var/lib/postgresql
tmpfs 3.9G 16K 3.9G 1% /etc/env/.secret/backup
tmpfs 3.9G 4.0K 3.9G 1% /etc/patroni/init-script.d/00001-create-gitlab-user.sql
tmpfs 3.9G 12K 3.9G 1% /run/secrets/kubernetes.io/serviceaccount
tmpfs 3.9G 0 3.9G 0% /proc/acpi
tmpfs 3.9G 0 3.9G 0% /sys/firmware
```
without restarting any pods.
**Notes:**
1- You cannot modified the sgclusters persistentVolume/size because you'll get the error:
```
4m9s Warning ClusterConfigFailed sgcluster/ongres-db StackGres Cluster ongres-db.ongres-db reconciliation failed: Failure executing: PATCH at: https://172.20.0.1/apis/apps/v1/namespaces/ongres-db/statefulsets/ongres-db. Message: StatefulSet.apps "ongres-db" is invalid: spec: Forbidden: updates to statefulset spec for fields other than 'replicas', 'template', and 'updateStrategy' are forbidden. Received status: Status(apiVersion=v1, code=422, details=StatusDetails(causes=[StatusCause(field=spec, message=Forbidden: updates to statefulset spec for fields other than 'replicas', 'template', and 'updateStrategy' are forbidden, reason=FieldValueForbidden, additionalProperties={})], group=apps, kind=StatefulSet, name=ongres-db, retryAfterSeconds=null, uid=null, additionalProperties={}), kind=Status, message=StatefulSet.apps "ongres-db" is invalid: spec: Forbidden: updates to statefulset spec for fields other than 'replicas', 'template', and 'updateStrategy' are forbidden, metadata=ListMeta(_continue=null, remainingItemCount=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=Invalid, status=Failure, additionalProperties={}).
```
2- The update need to be done modifying directly the PVC this let the sgcluster definition with the initial value and not the current value.
issue