WIP: RC pods

This commit is contained in:
Tim Allclair
2018-08-22 13:57:07 -07:00
parent 9af86c5535
commit 7f64bb649b
6 changed files with 49 additions and 0 deletions

View File

@@ -256,6 +256,11 @@ var ValidateClassName = apimachineryvalidation.NameIsDNSSubdomain
// class name is valid.
var ValidatePriorityClassName = apimachineryvalidation.NameIsDNSSubdomain
// ValidateRuntimeClassName can be used to check whether the given RuntimeClass name is valid.
// Prefix indicates this name will be used as part of generation, in which case
// trailing dashes are allowed.
var ValidateRuntimeClassName = apimachineryvalidation.NameIsDNSSubdomain
// Validates that given value is not negative.
func ValidateNonnegativeField(value int64, fldPath *field.Path) field.ErrorList {
return apimachineryvalidation.ValidateNonnegativeField(value, fldPath)
@@ -2999,6 +3004,14 @@ func ValidatePodSpec(spec *core.PodSpec, fldPath *field.Path) field.ErrorList {
}
}
if len(spec.RuntimeClassName) > 0 {
if utilfeature.DefaultFeatureGate.Enabled(features.RuntimeClass) {
for _, msg := range ValidateRuntimeClassName(spec.RuntimeClassName, false) {
allErrs = append(allErrs, field.Invalid(fldPath.Child("runtimeClassName"), spec.RuntimeClassName, msg))
}
}
}
return allErrs
}