You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
expectedErr: "spec.resourcePolicy.containerPolicies[0].oomBumpUpRatio: Invalid value: -1: spec.resourcePolicy.containerPolicies[0].oomBumpUpRatio in body should be greater than or equal to 1",
914
+
expectedErr: "admission webhook .*vpa.* denied the request:",
f.It("accepts valid and rejects invalid VPA object with features.PerVPAConfig enabled", framework.WithFeatureGate(features.PerVPAConfig), func() {
926
+
ginkgo.By("Setting up invalid VPA objects")
927
+
testCases:= []struct {
928
+
namestring
929
+
vpaJSONstring
930
+
expectedErrstring
931
+
}{
916
932
{
917
-
name: "Invalid oomBumpUpRatio (string value)",
933
+
name: "Invalid oomBumpUpRatio (negative value)",
918
934
vpaJSON: `{
919
935
"apiVersion": "autoscaling.k8s.io/v1",
920
936
"kind": "VerticalPodAutoscaler",
@@ -931,16 +947,16 @@ var _ = AdmissionControllerE2eDescribe("Admission-controller", func() {
931
947
"resourcePolicy": {
932
948
"containerPolicies": [{
933
949
"containerName": "*",
934
-
"oomBumpUpRatio": "12",
950
+
"oomBumpUpRatio": -1,
935
951
"oomMinBumpUp": 104857600
936
952
}]
937
953
}
938
954
}
939
955
}`,
940
-
expectedErr: "json: cannot unmarshal string into Go struct field ContainerResourcePolicy.spec.resourcePolicy.containerPolicies.oomBumpUpRatio of type float64",
956
+
expectedErr: "admission webhook \"vpa.k8s.io\" denied the request: oomBumpUpRatio must be greater than or equal to 1.0, got -1",
941
957
},
942
958
{
943
-
name: "Invalid oomBumpUpRatio (less than 1)",
959
+
name: "Invalid oomBumpUpRatio (string value)",
944
960
vpaJSON: `{
945
961
"apiVersion": "autoscaling.k8s.io/v1",
946
962
"kind": "VerticalPodAutoscaler",
@@ -957,16 +973,16 @@ var _ = AdmissionControllerE2eDescribe("Admission-controller", func() {
957
973
"resourcePolicy": {
958
974
"containerPolicies": [{
959
975
"containerName": "*",
960
-
"oomBumpUpRatio": 0.5,
976
+
"oomBumpUpRatio": "not-a-number",
961
977
"oomMinBumpUp": 104857600
962
978
}]
963
979
}
964
980
}
965
981
}`,
966
-
expectedErr: "spec.resourcePolicy.containerPolicies[0].oomBumpUpRatio: Invalid value: 0.5: spec.resourcePolicy.containerPolicies[0].oomBumpUpRatio in body should be greater than or equal to 1",
982
+
expectedErr: "admission webhook \"vpa\\.k8s\\.io\" denied the request: quantities must match the regular expression",
967
983
},
968
984
{
969
-
name: "Invalid oomMinBumpUp (negative value)",
985
+
name: "Invalid oomBumpUpRatio (less than 1)",
970
986
vpaJSON: `{
971
987
"apiVersion": "autoscaling.k8s.io/v1",
972
988
"kind": "VerticalPodAutoscaler",
@@ -983,45 +999,45 @@ var _ = AdmissionControllerE2eDescribe("Admission-controller", func() {
983
999
"resourcePolicy": {
984
1000
"containerPolicies": [{
985
1001
"containerName": "*",
986
-
"oomBumpUpRatio": 2,
987
-
"oomMinBumpUp": -1
1002
+
"oomBumpUpRatio": 0.5,
1003
+
"oomMinBumpUp": 104857600
988
1004
}]
989
1005
}
990
1006
}
991
1007
}`,
992
-
expectedErr: "spec.resourcePolicy.containerPolicies[0].oomMinBumpUp: Invalid value: -1: spec.resourcePolicy.containerPolicies[0].oomMinBumpUp in body should be greater than or equal to 0",
1008
+
expectedErr: "admission webhook \"vpa.k8s.io\" denied the request: oomBumpUpRatio must be greater than or equal to 1.0, got 0.5",
0 commit comments