File tree Expand file tree Collapse file tree 11 files changed +164
-0
lines changed
testing/kuttl/e2e-other/autogrow-volume Expand file tree Collapse file tree 11 files changed +164
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Ensure that the default StorageClass supports VolumeExpansion
2
+ apiVersion : storage.k8s.io/v1
3
+ kind : StorageClass
4
+ metadata :
5
+ annotations :
6
+ storageclass.kubernetes.io/is-default-class : " true"
7
+ allowVolumeExpansion : true
Original file line number Diff line number Diff line change
1
+ apiVersion : kuttl.dev/v1beta1
2
+ kind : TestStep
3
+ apply :
4
+ - files/01-create-cluster.yaml
5
+ assert :
6
+ - files/01-cluster-and-pvc-created.yaml
Original file line number Diff line number Diff line change
1
+ apiVersion : kuttl.dev/v1beta1
2
+ kind : TestStep
3
+ apply :
4
+ - files/02-create-data.yaml
5
+ assert :
6
+ - files/02-create-data-completed.yaml
Original file line number Diff line number Diff line change
1
+ ---
2
+ # Check that annotation is set
3
+ apiVersion : v1
4
+ kind : Pod
5
+ metadata :
6
+ labels :
7
+ postgres-operator.crunchydata.com/cluster : auto-grow-volume
8
+ postgres-operator.crunchydata.com/data : postgres
9
+ postgres-operator.crunchydata.com/instance-set : instance1
10
+ postgres-operator.crunchydata.com/patroni : auto-grow-volume-ha
11
+ annotations :
12
+ suggested-pgdata-pvc-size : 1461Mi
Original file line number Diff line number Diff line change
1
+ # We know that the PVC sizes have changed so now we can check that they have been
2
+ # updated to have the expected size
3
+ ---
4
+ apiVersion : v1
5
+ kind : PersistentVolumeClaim
6
+ metadata :
7
+ labels :
8
+ postgres-operator.crunchydata.com/cluster : auto-grow-volume
9
+ postgres-operator.crunchydata.com/instance-set : instance1
10
+ spec :
11
+ resources :
12
+ requests :
13
+ storage : 1461Mi
14
+ status :
15
+ accessModes :
16
+ - ReadWriteOnce
17
+ capacity :
18
+ storage : 2Gi
19
+ phase : Bound
Original file line number Diff line number Diff line change
1
+ ---
2
+ apiVersion : kuttl.dev/v1beta1
3
+ kind : TestStep
4
+ commands :
5
+ # Verify expected event has occurred
6
+ - script : |
7
+ EVENT=$(
8
+ kubectl get events --namespace="${NAMESPACE}" \
9
+ --field-selector reason="VolumeAutoGrow" --output=jsonpath={.items..message}
10
+ )
11
+
12
+ if [[ "${EVENT}" != "pgData volume expansion to 1461Mi requested for auto-grow-volume/instance1." ]]; then exit 1; fi
Original file line number Diff line number Diff line change
1
+ ### AutoGrow Volume
2
+
3
+ * 00: Assert the storage class allows volume expansion
4
+ * 01: Create and verify PostgresCluster and PVC
5
+ * 02: Add data to trigger growth and verify Job completes
6
+ * 03: Verify annotation on the instance Pod
7
+ * 04: Verify the PVC request has been set and the PVC has grown
8
+ * 05: Verify the expansion request Event has been created
9
+ Note: This Event should be created between steps 03 and 04 but is checked at the end for timing purposes.
Original file line number Diff line number Diff line change
1
+ apiVersion : postgres-operator.crunchydata.com/v1beta1
2
+ kind : PostgresCluster
3
+ metadata :
4
+ name : auto-grow-volume
5
+ status :
6
+ instances :
7
+ - name : instance1
8
+ readyReplicas : 1
9
+ replicas : 1
10
+ updatedReplicas : 1
11
+ ---
12
+ apiVersion : v1
13
+ kind : PersistentVolumeClaim
14
+ metadata :
15
+ labels :
16
+ postgres-operator.crunchydata.com/cluster : auto-grow-volume
17
+ postgres-operator.crunchydata.com/instance-set : instance1
18
+ spec :
19
+ resources :
20
+ requests :
21
+ storage : 1Gi
22
+ status :
23
+ accessModes :
24
+ - ReadWriteOnce
25
+ capacity :
26
+ storage : 1Gi
27
+ phase : Bound
Original file line number Diff line number Diff line change
1
+ apiVersion : postgres-operator.crunchydata.com/v1beta1
2
+ kind : PostgresCluster
3
+ metadata :
4
+ name : auto-grow-volume
5
+ spec :
6
+ postgresVersion : ${KUTTL_PG_VERSION}
7
+ instances :
8
+ - name : instance1
9
+ dataVolumeClaimSpec :
10
+ accessModes :
11
+ - " ReadWriteOnce"
12
+ resources :
13
+ requests :
14
+ storage : 1Gi
15
+ limits :
16
+ storage : 2Gi
17
+ backups :
18
+ pgbackrest :
19
+ repos :
20
+ - name : repo1
21
+ volume :
22
+ volumeClaimSpec :
23
+ accessModes :
24
+ - " ReadWriteOnce"
25
+ resources :
26
+ requests :
27
+ storage : 1Gi
Original file line number Diff line number Diff line change
1
+ ---
2
+ apiVersion : batch/v1
3
+ kind : Job
4
+ metadata :
5
+ name : create-data
6
+ status :
7
+ succeeded : 1
You can’t perform that action at this time.
0 commit comments