@@ -32,6 +32,9 @@ import (
32
32
const isNegativeErrorMsg string = `must be greater than or equal to 0`
33
33
const isNotIntegerErrorMsg string = `must be an integer`
34
34
35
+ // ValidateResourceRequirements will check if any of the resource
36
+ // Limits/Requests are of a valid value. Any incorrect value will be added to
37
+ // the ErrorList.
35
38
func ValidateResourceRequirements (requirements * v1.ResourceRequirements , fldPath * field.Path ) field.ErrorList {
36
39
allErrs := field.ErrorList {}
37
40
limPath := fldPath .Child ("limits" )
@@ -93,7 +96,7 @@ func ValidateResourceQuantityValue(resource string, value resource.Quantity, fld
93
96
return allErrs
94
97
}
95
98
96
- // Validates that a Quantity is not negative
99
+ // ValidateNonnegativeQuantity checks that a Quantity is not negative.
97
100
func ValidateNonnegativeQuantity (value resource.Quantity , fldPath * field.Path ) field.ErrorList {
98
101
allErrs := field.ErrorList {}
99
102
if value .Cmp (resource.Quantity {}) < 0 {
@@ -122,6 +125,8 @@ func validateResourceName(value string, fldPath *field.Path) field.ErrorList {
122
125
return allErrs
123
126
}
124
127
128
+ // ValidatePodLogOptions checks if options that are set are at the correct
129
+ // value. Any incorrect value will be returned to the ErrorList.
125
130
func ValidatePodLogOptions (opts * v1.PodLogOptions ) field.ErrorList {
126
131
allErrs := field.ErrorList {}
127
132
if opts .TailLines != nil && * opts .TailLines < 0 {
@@ -141,6 +146,8 @@ func ValidatePodLogOptions(opts *v1.PodLogOptions) field.ErrorList {
141
146
return allErrs
142
147
}
143
148
149
+ // AccumulateUniqueHostPorts checks all the containers for duplicates ports. Any
150
+ // duplicate port will be returned in the ErrorList.
144
151
func AccumulateUniqueHostPorts (containers []v1.Container , accumulator * sets.String , fldPath * field.Path ) field.ErrorList {
145
152
allErrs := field.ErrorList {}
146
153
0 commit comments