Skip to content

Commit

Permalink
Merge pull request kubernetes#23801 from sttts/sttts-pvc-negative-res…
Browse files Browse the repository at this point in the history
…ource-error-message

Bug 1743675: validations: for negative PVC storage size don't report "must be >= 0"

Origin-commit: 164fc5b8b6ff3a8f911bdf6c8ca94a7666de9e3d
  • Loading branch information
k8s-publishing-bot committed Sep 19, 2019
2 parents 290c151 + 3e34543 commit 816e501
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/apis/core/validation/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -1824,9 +1824,10 @@ func ValidatePersistentVolumeClaimSpec(spec *core.PersistentVolumeClaimSpec, fld
storageValue, ok := spec.Resources.Requests[core.ResourceStorage]
if !ok {
allErrs = append(allErrs, field.Required(fldPath.Child("resources").Key(string(core.ResourceStorage)), ""))
} else if errs := ValidatePositiveQuantityValue(storageValue, fldPath.Child("resources").Key(string(core.ResourceStorage))); len(errs) > 0 {
allErrs = append(allErrs, errs...)
} else {
allErrs = append(allErrs, ValidateResourceQuantityValue(string(core.ResourceStorage), storageValue, fldPath.Child("resources").Key(string(core.ResourceStorage)))...)
allErrs = append(allErrs, ValidatePositiveQuantityValue(storageValue, fldPath.Child("resources").Key(string(core.ResourceStorage)))...)
}

if spec.StorageClassName != nil && len(*spec.StorageClassName) > 0 {
Expand Down

0 comments on commit 816e501

Please sign in to comment.