diff --git a/charts/postgres-operator/crds/operatorconfigurations.yaml b/charts/postgres-operator/crds/operatorconfigurations.yaml index 6b7c463073888e19dbc9debd7718060e005a7aa3..3949fde6cc9f1688bb4a9af9ccd7b0ab8b52f2dd 100644 --- a/charts/postgres-operator/crds/operatorconfigurations.yaml +++ b/charts/postgres-operator/crds/operatorconfigurations.yaml @@ -321,6 +321,7 @@ spec: type: string enum: - "ebs" + - "mixed" - "pvc" - "off" default: "pvc" diff --git a/charts/postgres-operator/values.yaml b/charts/postgres-operator/values.yaml index 86cbb2986c76864846109077e3143469742367e9..15b6938706a76f8d49786bf24d6ba598cf88010f 100644 --- a/charts/postgres-operator/values.yaml +++ b/charts/postgres-operator/values.yaml @@ -196,7 +196,7 @@ configKubernetes: # whether the Spilo container should run with additional permissions other than parent. # required by cron which needs setuid spilo_allow_privilege_escalation: true - # storage resize strategy, available options are: ebs, pvc, off + # storage resize strategy, available options are: ebs, pvc, off or mixed storage_resize_mode: pvc # pod toleration assigned to instances of every Postgres cluster # toleration: diff --git a/docs/reference/operator_parameters.md b/docs/reference/operator_parameters.md index 8aa76aa7bece1b8ce88f97d67fd42e2af89660fc..104d574f61286cf7394fff89a67f9a15a4a23880 100644 --- a/docs/reference/operator_parameters.md +++ b/docs/reference/operator_parameters.md @@ -486,10 +486,10 @@ configuration they are grouped under the `kubernetes` key. * **storage_resize_mode** defines how operator handles the difference between the requested volume size and the actual size. Available options are: - 1. `ebs` : operator resizes EBS volumes directly and executes `resizefs` within a pod - 2. `pvc` : operator only changes PVC definition - 3. `off` : disables resize of the volumes. - 4. `mixed` :operator uses AWS API to adjust size, throughput, and IOPS, and calls pvc change for file system resize + 1. `ebs` : operator resizes EBS volumes directly and executes `resizefs` within a pod + 2. `pvc` : operator only changes PVC definition + 3. `off` : disables resize of the volumes. + 4. `mixed` : operator uses AWS API to adjust size, throughput, and IOPS, and calls pvc change for file system resize Default is "pvc". ## Kubernetes resource requests diff --git a/docs/user.md b/docs/user.md index 0fc7c35f28c05282850b3cf699e23ee6b67c29a0..62850ec4d5f8a1ceaceccd5815c397597599ca21 100644 --- a/docs/user.md +++ b/docs/user.md @@ -1029,9 +1029,9 @@ specified but globally disabled in the configuration. The ## Increase volume size -Postgres operator supports statefulset volume resize if you're using the -operator on top of AWS. For that you need to change the size field of the -volume description in the cluster manifest and apply the change: +Postgres operator supports statefulset volume resize without doing a rolling +update. For that you need to change the size field of the volume description +in the cluster manifest and apply the change: ```yaml spec: @@ -1040,22 +1040,29 @@ spec: ``` The operator compares the new value of the size field with the previous one and -acts on differences. +acts on differences. The `storage_resize_mode` can be configured. By default, +the operator will adjust the PVCs and leave it to K8s and the infrastructure to +apply the change. -You can only enlarge the volume with the process described above, shrinking is -not supported and will emit a warning. After this update all the new volumes in -the statefulset are allocated according to the new size. To enlarge persistent -volumes attached to the running pods, the operator performs the following -actions: +When using AWS with gp3 volumes you should set the mode to `mixed` because it +will also adjust the IOPS and throughput that can be defined in the manifest. +Check the [AWS docs](https://aws.amazon.com/ebs/general-purpose/) to learn +about default and maximum values. Keep in mind that AWS rate-limits updating +volume specs to no more than once every 6 hours. -* call AWS API to change the volume size - -* connect to pod using `kubectl exec` and resize filesystem with `resize2fs`. +```yaml +spec: + volume: + size: 5Gi # new volume size + iops: 4000 + throughput: 500 +``` -Fist step has a limitation, AWS rate-limits this operation to no more than once -every 6 hours. Note, that if the statefulset is scaled down before resizing the -new size is only applied to the volumes attached to the running pods. The -size of volumes that correspond to the previously running pods is not changed. +The operator can only enlarge volumes. Shrinking is not supported and will emit +a warning. However, it can be done manually after updating the manifest. You +have to delete the PVC, which will hang until you also delete the corresponding +pod. Proceed with the next pod when the cluster is healthy again and replicas +are streaming. ## Logical backups diff --git a/manifests/operatorconfiguration.crd.yaml b/manifests/operatorconfiguration.crd.yaml index aae9e502b33d81b2e321f4a0209232fcfecf6eba..24ea04748ae8c8f7867e0902755d652f94efe3af 100644 --- a/manifests/operatorconfiguration.crd.yaml +++ b/manifests/operatorconfiguration.crd.yaml @@ -319,6 +319,7 @@ spec: type: string enum: - "ebs" + - "mixed" - "pvc" - "off" default: "pvc" diff --git a/pkg/apis/acid.zalan.do/v1/crds.go b/pkg/apis/acid.zalan.do/v1/crds.go index e672e473dc5301e94e535dad6c9d9160bb1f4f46..e361843bef2b0d8a66706fc95b79967aae442d13 100644 --- a/pkg/apis/acid.zalan.do/v1/crds.go +++ b/pkg/apis/acid.zalan.do/v1/crds.go @@ -1428,6 +1428,9 @@ var OperatorConfigCRDResourceValidation = apiextv1.CustomResourceValidation{ { Raw: []byte(`"ebs"`), }, + { + Raw: []byte(`"mixed"`), + }, { Raw: []byte(`"pvc"`), },