Skip to content

Commit 1c80ac0

Browse files
authored
add storage_resize_mode mixed to opConfig CRD (zalando#1947)
1 parent 5e4badd commit 1c80ac0

File tree

6 files changed

+33
-21
lines changed

6 files changed

+33
-21
lines changed

charts/postgres-operator/crds/operatorconfigurations.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ spec:
321321
type: string
322322
enum:
323323
- "ebs"
324+
- "mixed"
324325
- "pvc"
325326
- "off"
326327
default: "pvc"

charts/postgres-operator/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ configKubernetes:
196196
# whether the Spilo container should run with additional permissions other than parent.
197197
# required by cron which needs setuid
198198
spilo_allow_privilege_escalation: true
199-
# storage resize strategy, available options are: ebs, pvc, off
199+
# storage resize strategy, available options are: ebs, pvc, off or mixed
200200
storage_resize_mode: pvc
201201
# pod toleration assigned to instances of every Postgres cluster
202202
# toleration:

docs/reference/operator_parameters.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -486,10 +486,10 @@ configuration they are grouped under the `kubernetes` key.
486486
* **storage_resize_mode**
487487
defines how operator handles the difference between the requested volume size and
488488
the actual size. Available options are:
489-
1. `ebs` : operator resizes EBS volumes directly and executes `resizefs` within a pod
490-
2. `pvc` : operator only changes PVC definition
491-
3. `off` : disables resize of the volumes.
492-
4. `mixed` :operator uses AWS API to adjust size, throughput, and IOPS, and calls pvc change for file system resize
489+
1. `ebs` : operator resizes EBS volumes directly and executes `resizefs` within a pod
490+
2. `pvc` : operator only changes PVC definition
491+
3. `off` : disables resize of the volumes.
492+
4. `mixed` : operator uses AWS API to adjust size, throughput, and IOPS, and calls pvc change for file system resize
493493
Default is "pvc".
494494

495495
## Kubernetes resource requests

docs/user.md

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,9 +1029,9 @@ specified but globally disabled in the configuration. The
10291029

10301030
## Increase volume size
10311031

1032-
Postgres operator supports statefulset volume resize if you're using the
1033-
operator on top of AWS. For that you need to change the size field of the
1034-
volume description in the cluster manifest and apply the change:
1032+
Postgres operator supports statefulset volume resize without doing a rolling
1033+
update. For that you need to change the size field of the volume description
1034+
in the cluster manifest and apply the change:
10351035

10361036
```yaml
10371037
spec:
@@ -1040,22 +1040,29 @@ spec:
10401040
```
10411041

10421042
The operator compares the new value of the size field with the previous one and
1043-
acts on differences.
1043+
acts on differences. The `storage_resize_mode` can be configured. By default,
1044+
the operator will adjust the PVCs and leave it to K8s and the infrastructure to
1045+
apply the change.
10441046

1045-
You can only enlarge the volume with the process described above, shrinking is
1046-
not supported and will emit a warning. After this update all the new volumes in
1047-
the statefulset are allocated according to the new size. To enlarge persistent
1048-
volumes attached to the running pods, the operator performs the following
1049-
actions:
1047+
When using AWS with gp3 volumes you should set the mode to `mixed` because it
1048+
will also adjust the IOPS and throughput that can be defined in the manifest.
1049+
Check the [AWS docs](https://aws.amazon.com/ebs/general-purpose/) to learn
1050+
about default and maximum values. Keep in mind that AWS rate-limits updating
1051+
volume specs to no more than once every 6 hours.
10501052

1051-
* call AWS API to change the volume size
1052-
1053-
* connect to pod using `kubectl exec` and resize filesystem with `resize2fs`.
1053+
```yaml
1054+
spec:
1055+
volume:
1056+
size: 5Gi # new volume size
1057+
iops: 4000
1058+
throughput: 500
1059+
```
10541060

1055-
Fist step has a limitation, AWS rate-limits this operation to no more than once
1056-
every 6 hours. Note, that if the statefulset is scaled down before resizing the
1057-
new size is only applied to the volumes attached to the running pods. The
1058-
size of volumes that correspond to the previously running pods is not changed.
1061+
The operator can only enlarge volumes. Shrinking is not supported and will emit
1062+
a warning. However, it can be done manually after updating the manifest. You
1063+
have to delete the PVC, which will hang until you also delete the corresponding
1064+
pod. Proceed with the next pod when the cluster is healthy again and replicas
1065+
are streaming.
10591066

10601067
## Logical backups
10611068

manifests/operatorconfiguration.crd.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ spec:
319319
type: string
320320
enum:
321321
- "ebs"
322+
- "mixed"
322323
- "pvc"
323324
- "off"
324325
default: "pvc"

pkg/apis/acid.zalan.do/v1/crds.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,6 +1428,9 @@ var OperatorConfigCRDResourceValidation = apiextv1.CustomResourceValidation{
14281428
{
14291429
Raw: []byte(`"ebs"`),
14301430
},
1431+
{
1432+
Raw: []byte(`"mixed"`),
1433+
},
14311434
{
14321435
Raw: []byte(`"pvc"`),
14331436
},

0 commit comments

Comments
 (0)