Merge pull request #35437 from markturansky/loosen_pvc_limit_range_validation
Automatic merge from submit-queue Loosened validation on PVC LimitRanger This PR loosens validation on PVC LimitRanger so that either Min or Max are required, but not both. Per @derekwaynecarr https://github.com/openshift/origin/pull/11396#discussion_r84533061
This commit is contained in:
@@ -7069,6 +7069,28 @@ func TestValidateLimitRange(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "pvc-min-only",
|
||||
spec: api.LimitRangeSpec{
|
||||
Limits: []api.LimitRangeItem{
|
||||
{
|
||||
Type: api.LimitTypePersistentVolumeClaim,
|
||||
Min: getStorageResourceList("5Gi"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "pvc-max-only",
|
||||
spec: api.LimitRangeSpec{
|
||||
Limits: []api.LimitRangeItem{
|
||||
{
|
||||
Type: api.LimitTypePersistentVolumeClaim,
|
||||
Max: getStorageResourceList("10Gi"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "all-fields-valid-big-numbers",
|
||||
spec: api.LimitRangeSpec{
|
||||
@@ -7276,27 +7298,15 @@ func TestValidateLimitRange(t *testing.T) {
|
||||
}},
|
||||
"must be a standard limit type or fully qualified",
|
||||
},
|
||||
"invalid missing required min field": {
|
||||
"min and max values missing, one required": {
|
||||
api.LimitRange{ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: "foo"}, Spec: api.LimitRangeSpec{
|
||||
Limits: []api.LimitRangeItem{
|
||||
{
|
||||
Type: api.LimitTypePersistentVolumeClaim,
|
||||
Max: getStorageResourceList("10000T"),
|
||||
},
|
||||
},
|
||||
}},
|
||||
"minimum storage value is required",
|
||||
},
|
||||
"invalid missing required max field": {
|
||||
api.LimitRange{ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: "foo"}, Spec: api.LimitRangeSpec{
|
||||
Limits: []api.LimitRangeItem{
|
||||
{
|
||||
Type: api.LimitTypePersistentVolumeClaim,
|
||||
Min: getStorageResourceList("10000T"),
|
||||
},
|
||||
},
|
||||
}},
|
||||
"maximum storage value is required",
|
||||
"either minimum or maximum storage value is required, but neither was provided",
|
||||
},
|
||||
"invalid min greater than max": {
|
||||
api.LimitRange{ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: "foo"}, Spec: api.LimitRangeSpec{
|
||||
|
Reference in New Issue
Block a user