mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Merge pull request #88484 from steveazz/steveazz/68026-validaton
Fix golint issues for `core/v1/validation`
This commit is contained in:
commit
390a54f737
@ -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
|
||||
|
@ -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{}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user