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:
Kubernetes Submit Queue
2016-11-09 02:01:52 -08:00
committed by GitHub
2 changed files with 26 additions and 19 deletions

View File

@@ -3047,11 +3047,8 @@ func ValidateLimitRange(limitRange *api.LimitRange) field.ErrorList {
if limit.Type == api.LimitTypePersistentVolumeClaim {
_, minQuantityFound := limit.Min[api.ResourceStorage]
_, maxQuantityFound := limit.Max[api.ResourceStorage]
if !minQuantityFound {
allErrs = append(allErrs, field.Required(idxPath.Child("min"), "minimum storage value is required"))
}
if !maxQuantityFound {
allErrs = append(allErrs, field.Required(idxPath.Child("max"), "maximum storage value is required"))
if !minQuantityFound && !maxQuantityFound {
allErrs = append(allErrs, field.Required(idxPath.Child("limits"), "either minimum or maximum storage value is required, but neither was provided"))
}
}