Merge pull request #30145 from markturansky/limit_range_pvc
Automatic merge from submit-queue Add PVC storage to LimitRange This PR adds the ability to add a LimitRange to a namespace that enforces min/max on `pvc.Spec.Resources.Requests["storage"]`. @derekwaynecarr @abhgupta @kubernetes/sig-storage Examples forthcoming. ```release-note pvc.Spec.Resources.Requests min and max can be enforced with a LimitRange of type "PersistentVolumeClaim" in the namespace ```
This commit is contained in:
@@ -6542,6 +6542,11 @@ func TestValidateLimitRange(t *testing.T) {
|
||||
DefaultRequest: getResourceList("10m", "200Mi"),
|
||||
MaxLimitRequestRatio: getResourceList("10", ""),
|
||||
},
|
||||
{
|
||||
Type: api.LimitTypePersistentVolumeClaim,
|
||||
Max: getStorageResourceList("10Gi"),
|
||||
Min: getStorageResourceList("5Gi"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -6752,6 +6757,40 @@ func TestValidateLimitRange(t *testing.T) {
|
||||
}},
|
||||
"must be a standard limit type or fully qualified",
|
||||
},
|
||||
"invalid missing required min field": {
|
||||
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",
|
||||
},
|
||||
"invalid min greater than max": {
|
||||
api.LimitRange{ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: "foo"}, Spec: api.LimitRangeSpec{
|
||||
Limits: []api.LimitRangeItem{
|
||||
{
|
||||
Type: api.LimitTypePersistentVolumeClaim,
|
||||
Min: getStorageResourceList("10Gi"),
|
||||
Max: getStorageResourceList("1Gi"),
|
||||
},
|
||||
},
|
||||
}},
|
||||
"min value 10Gi is greater than max value 1Gi",
|
||||
},
|
||||
}
|
||||
|
||||
for k, v := range errorCases {
|
||||
|
Reference in New Issue
Block a user