Skip to content

Commit 59bf8a9

Browse files
gkechhors
andauthored
K8SPSMDB-1472 introduce grouping of storageScaling options (#2213)
* K8SPSMDB-1472 introduce grouping of storageScaling options * generate manifests and fix e2e tests * fixes * cr: add stotagescaling.enablevolumescaling new option to unsafe psa test * add comment * validation for autoscaling and unit test * cr: remove duplicate GrowthStep init * cr: add validation for enableExternalAutoscaling and autoscaling * generate manifests again with main --------- Co-authored-by: Viacheslav Sarzhan <slava.sarzhan@percona.com>
1 parent c8ae8df commit 59bf8a9

File tree

20 files changed

+567
-213
lines changed

20 files changed

+567
-213
lines changed

config/crd/bases/psmdb.percona.com_perconaservermongodbs.yaml

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25369,29 +25369,46 @@ spec:
2536925369
required:
2537025370
- enabled
2537125371
type: object
25372-
storageAutoscaling:
25372+
storageScaling:
2537325373
properties:
25374-
enabled:
25374+
autoscaling:
25375+
properties:
25376+
enabled:
25377+
type: boolean
25378+
growthStep:
25379+
anyOf:
25380+
- type: integer
25381+
- type: string
25382+
default: 2Gi
25383+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
25384+
x-kubernetes-int-or-string: true
25385+
maxSize:
25386+
anyOf:
25387+
- type: integer
25388+
- type: string
25389+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
25390+
x-kubernetes-int-or-string: true
25391+
triggerThresholdPercent:
25392+
default: 80
25393+
maximum: 95
25394+
minimum: 50
25395+
type: integer
25396+
type: object
25397+
enableExternalAutoscaling:
25398+
type: boolean
25399+
enableVolumeScaling:
2537525400
type: boolean
25376-
growthStep:
25377-
anyOf:
25378-
- type: integer
25379-
- type: string
25380-
default: 2Gi
25381-
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
25382-
x-kubernetes-int-or-string: true
25383-
maxSize:
25384-
anyOf:
25385-
- type: integer
25386-
- type: string
25387-
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
25388-
x-kubernetes-int-or-string: true
25389-
triggerThresholdPercent:
25390-
default: 80
25391-
maximum: 95
25392-
minimum: 50
25393-
type: integer
2539425401
type: object
25402+
x-kubernetes-validations:
25403+
- message: autoscaling cannot be enabled when enableVolumeScaling
25404+
is disabled
25405+
rule: '!has(self.autoscaling) || !has(self.autoscaling.enabled)
25406+
|| !self.autoscaling.enabled || self.enableVolumeScaling'
25407+
- message: autoscaling cannot be enabled when enableExternalAutoscaling
25408+
is enabled
25409+
rule: '!has(self.autoscaling) || !has(self.autoscaling.enabled)
25410+
|| !self.autoscaling.enabled || !has(self.enableExternalAutoscaling)
25411+
|| !self.enableExternalAutoscaling'
2539525412
tls:
2539625413
properties:
2539725414
allowInvalidCertificates:

deploy/bundle.yaml

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26256,29 +26256,46 @@ spec:
2625626256
required:
2625726257
- enabled
2625826258
type: object
26259-
storageAutoscaling:
26259+
storageScaling:
2626026260
properties:
26261-
enabled:
26261+
autoscaling:
26262+
properties:
26263+
enabled:
26264+
type: boolean
26265+
growthStep:
26266+
anyOf:
26267+
- type: integer
26268+
- type: string
26269+
default: 2Gi
26270+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
26271+
x-kubernetes-int-or-string: true
26272+
maxSize:
26273+
anyOf:
26274+
- type: integer
26275+
- type: string
26276+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
26277+
x-kubernetes-int-or-string: true
26278+
triggerThresholdPercent:
26279+
default: 80
26280+
maximum: 95
26281+
minimum: 50
26282+
type: integer
26283+
type: object
26284+
enableExternalAutoscaling:
26285+
type: boolean
26286+
enableVolumeScaling:
2626226287
type: boolean
26263-
growthStep:
26264-
anyOf:
26265-
- type: integer
26266-
- type: string
26267-
default: 2Gi
26268-
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
26269-
x-kubernetes-int-or-string: true
26270-
maxSize:
26271-
anyOf:
26272-
- type: integer
26273-
- type: string
26274-
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
26275-
x-kubernetes-int-or-string: true
26276-
triggerThresholdPercent:
26277-
default: 80
26278-
maximum: 95
26279-
minimum: 50
26280-
type: integer
2628126288
type: object
26289+
x-kubernetes-validations:
26290+
- message: autoscaling cannot be enabled when enableVolumeScaling
26291+
is disabled
26292+
rule: '!has(self.autoscaling) || !has(self.autoscaling.enabled)
26293+
|| !self.autoscaling.enabled || self.enableVolumeScaling'
26294+
- message: autoscaling cannot be enabled when enableExternalAutoscaling
26295+
is enabled
26296+
rule: '!has(self.autoscaling) || !has(self.autoscaling.enabled)
26297+
|| !self.autoscaling.enabled || !has(self.enableExternalAutoscaling)
26298+
|| !self.enableExternalAutoscaling'
2628226299
tls:
2628326300
properties:
2628426301
allowInvalidCertificates:

deploy/cr.yaml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ spec:
1212
# clusterServiceDNSMode: "Internal"
1313
# pause: true
1414
# unmanaged: false
15-
# enableVolumeExpansion: true
16-
# storageAutoscaling:
17-
# enabled: true
18-
# triggerThresholdPercent: 80
19-
# growthStep: 2Gi
20-
# maxSize: "10Gi"
21-
# enableExternalVolumeAutoscaling: false
15+
# storageScaling:
16+
# enableExternalAutoscaling: false
17+
# enableVolumeScaling: false
18+
# autoscaling:
19+
# enabled: false
20+
# triggerThresholdPercent: 80
21+
# growthStep: 2Gi
22+
# maxSize: "10Gi"
2223
crVersion: 1.22.0
2324
image: perconalab/percona-server-mongodb-operator:main-mongod8.0
2425
imagePullPolicy: Always

deploy/crd.yaml

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26256,29 +26256,46 @@ spec:
2625626256
required:
2625726257
- enabled
2625826258
type: object
26259-
storageAutoscaling:
26259+
storageScaling:
2626026260
properties:
26261-
enabled:
26261+
autoscaling:
26262+
properties:
26263+
enabled:
26264+
type: boolean
26265+
growthStep:
26266+
anyOf:
26267+
- type: integer
26268+
- type: string
26269+
default: 2Gi
26270+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
26271+
x-kubernetes-int-or-string: true
26272+
maxSize:
26273+
anyOf:
26274+
- type: integer
26275+
- type: string
26276+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
26277+
x-kubernetes-int-or-string: true
26278+
triggerThresholdPercent:
26279+
default: 80
26280+
maximum: 95
26281+
minimum: 50
26282+
type: integer
26283+
type: object
26284+
enableExternalAutoscaling:
26285+
type: boolean
26286+
enableVolumeScaling:
2626226287
type: boolean
26263-
growthStep:
26264-
anyOf:
26265-
- type: integer
26266-
- type: string
26267-
default: 2Gi
26268-
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
26269-
x-kubernetes-int-or-string: true
26270-
maxSize:
26271-
anyOf:
26272-
- type: integer
26273-
- type: string
26274-
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
26275-
x-kubernetes-int-or-string: true
26276-
triggerThresholdPercent:
26277-
default: 80
26278-
maximum: 95
26279-
minimum: 50
26280-
type: integer
2628126288
type: object
26289+
x-kubernetes-validations:
26290+
- message: autoscaling cannot be enabled when enableVolumeScaling
26291+
is disabled
26292+
rule: '!has(self.autoscaling) || !has(self.autoscaling.enabled)
26293+
|| !self.autoscaling.enabled || self.enableVolumeScaling'
26294+
- message: autoscaling cannot be enabled when enableExternalAutoscaling
26295+
is enabled
26296+
rule: '!has(self.autoscaling) || !has(self.autoscaling.enabled)
26297+
|| !self.autoscaling.enabled || !has(self.enableExternalAutoscaling)
26298+
|| !self.enableExternalAutoscaling'
2628226299
tls:
2628326300
properties:
2628426301
allowInvalidCertificates:

deploy/cw-bundle.yaml

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26256,29 +26256,46 @@ spec:
2625626256
required:
2625726257
- enabled
2625826258
type: object
26259-
storageAutoscaling:
26259+
storageScaling:
2626026260
properties:
26261-
enabled:
26261+
autoscaling:
26262+
properties:
26263+
enabled:
26264+
type: boolean
26265+
growthStep:
26266+
anyOf:
26267+
- type: integer
26268+
- type: string
26269+
default: 2Gi
26270+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
26271+
x-kubernetes-int-or-string: true
26272+
maxSize:
26273+
anyOf:
26274+
- type: integer
26275+
- type: string
26276+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
26277+
x-kubernetes-int-or-string: true
26278+
triggerThresholdPercent:
26279+
default: 80
26280+
maximum: 95
26281+
minimum: 50
26282+
type: integer
26283+
type: object
26284+
enableExternalAutoscaling:
26285+
type: boolean
26286+
enableVolumeScaling:
2626226287
type: boolean
26263-
growthStep:
26264-
anyOf:
26265-
- type: integer
26266-
- type: string
26267-
default: 2Gi
26268-
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
26269-
x-kubernetes-int-or-string: true
26270-
maxSize:
26271-
anyOf:
26272-
- type: integer
26273-
- type: string
26274-
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
26275-
x-kubernetes-int-or-string: true
26276-
triggerThresholdPercent:
26277-
default: 80
26278-
maximum: 95
26279-
minimum: 50
26280-
type: integer
2628126288
type: object
26289+
x-kubernetes-validations:
26290+
- message: autoscaling cannot be enabled when enableVolumeScaling
26291+
is disabled
26292+
rule: '!has(self.autoscaling) || !has(self.autoscaling.enabled)
26293+
|| !self.autoscaling.enabled || self.enableVolumeScaling'
26294+
- message: autoscaling cannot be enabled when enableExternalAutoscaling
26295+
is enabled
26296+
rule: '!has(self.autoscaling) || !has(self.autoscaling.enabled)
26297+
|| !self.autoscaling.enabled || !has(self.enableExternalAutoscaling)
26298+
|| !self.enableExternalAutoscaling'
2628226299
tls:
2628326300
properties:
2628426301
allowInvalidCertificates:

e2e-tests/pvc-auto-resize/conf/some-name.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@ spec:
99
image:
1010
imagePullPolicy: Always
1111
allowUnsafeConfigurations: false
12-
enableVolumeExpansion: true
13-
storageAutoscaling:
14-
enabled: true
15-
triggerThresholdPercent: 80
16-
growthStep: "2Gi"
17-
maxSize: "10Gi"
12+
storageScaling:
13+
enableVolumeScaling: true
14+
autoscaling:
15+
enabled: true
16+
triggerThresholdPercent: 80
17+
growthStep: "2Gi"
18+
maxSize: "10Gi"
1819
backup:
1920
enabled: false
2021
replsets:

e2e-tests/pvc-resize/run

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ if wait_all_pvc_resize "2Gi" 120 1; then
101101
fi
102102

103103
echo "Enabling PVC resize"
104-
kubectl_bin patch psmdb "${cluster}" --type=json -p='[{"op": "add", "path": "/spec/enableVolumeExpansion", "value":true }]'
104+
kubectl_bin patch psmdb "${cluster}" --type=json -p='[{"op": "add", "path": "/spec/storageScaling", "value":{"enableVolumeScaling":true} }]'
105105
sleep 10
106106

107107
wait_cluster_consistency "$cluster"
@@ -121,7 +121,7 @@ if [[ $EKS == 1 || -n ${OPENSHIFT} ]]; then
121121
spinup_psmdb "${cluster}-rs0" "$test_dir/conf/$cluster.yml"
122122
fi
123123
echo "Enabling PVC resize after recreating PSMDB cluster ${cluster} "
124-
kubectl_bin patch psmdb "${cluster}" --type=json -p='[{"op": "add", "path": "/spec/enableVolumeExpansion", "value":true }]'
124+
kubectl_bin patch psmdb "${cluster}" --type=json -p='[{"op": "add", "path": "/spec/storageScaling", "value":{"enableVolumeScaling":true} }]'
125125
sleep 10
126126

127127
wait_cluster_consistency "$cluster"

e2e-tests/unsafe-psa/conf/unsafe-psa-rs0.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ spec:
66
#platform: openshift
77
image:
88
imagePullPolicy: Always
9-
enableVolumeExpansion: true
9+
storageScaling:
10+
enableVolumeScaling: true
1011
unsafeFlags:
1112
replsetSize: true
1213
secrets:

e2e-tests/unsafe-psa/run

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ function main() {
4848
spinup_psmdb "$cluster" "$test_dir/conf/$cluster.yml" "3"
4949
wait_cluster_consistency "$psmdb"
5050

51+
# PVC resize did not work for PSA deployment and it was fixed in 1.22
5152
desc 'resizing PVCs'
5253
patch_pvc_request "$psmdb" "2G"
5354
wait_cluster_consistency "$psmdb"

0 commit comments

Comments
 (0)