Merge pull request #88484 from steveazz/steveazz/68026-validaton

Fix golint issues for `core/v1/validation`
This commit is contained in:
Kubernetes Prow Robot 2020-02-24 19:07:25 -08:00 committed by GitHub
commit 390a54f737
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -27,7 +27,6 @@ pkg/apis/core/helper/qos
pkg/apis/core/v1
pkg/apis/core/v1/helper
pkg/apis/core/v1/helper/qos
pkg/apis/core/v1/validation
pkg/apis/core/validation
pkg/apis/discovery/v1alpha1
pkg/apis/discovery/v1beta1

View File

@ -32,6 +32,9 @@ import (
const isNegativeErrorMsg string = `must be greater than or equal to 0`
const isNotIntegerErrorMsg string = `must be an integer`
// ValidateResourceRequirements will check if any of the resource
// Limits/Requests are of a valid value. Any incorrect value will be added to
// the ErrorList.
func ValidateResourceRequirements(requirements *v1.ResourceRequirements, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
limPath := fldPath.Child("limits")
@ -93,7 +96,7 @@ func ValidateResourceQuantityValue(resource string, value resource.Quantity, fld
return allErrs
}
// Validates that a Quantity is not negative
// ValidateNonnegativeQuantity checks that a Quantity is not negative.
func ValidateNonnegativeQuantity(value resource.Quantity, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
if value.Cmp(resource.Quantity{}) < 0 {
@ -122,6 +125,8 @@ func validateResourceName(value string, fldPath *field.Path) field.ErrorList {
return allErrs
}
// ValidatePodLogOptions checks if options that are set are at the correct
// value. Any incorrect value will be returned to the ErrorList.
func ValidatePodLogOptions(opts *v1.PodLogOptions) field.ErrorList {
allErrs := field.ErrorList{}
if opts.TailLines != nil && *opts.TailLines < 0 {
@ -141,6 +146,8 @@ func ValidatePodLogOptions(opts *v1.PodLogOptions) field.ErrorList {
return allErrs
}
// AccumulateUniqueHostPorts checks all the containers for duplicates ports. Any
// duplicate port will be returned in the ErrorList.
func AccumulateUniqueHostPorts(containers []v1.Container, accumulator *sets.String, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}