mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-10-08 03:37:49 +00:00
change preempting to PreemptionPolicy
This commit is contained in:
@@ -2653,6 +2653,19 @@ func validateRestartPolicy(restartPolicy *core.RestartPolicy, fldPath *field.Pat
|
||||
return allErrors
|
||||
}
|
||||
|
||||
func ValidatePreemptionPolicy(preemptionPolicy *core.PreemptionPolicy, fldPath *field.Path) field.ErrorList {
|
||||
allErrors := field.ErrorList{}
|
||||
switch *preemptionPolicy {
|
||||
case core.PreemptLowerPriority, core.PreemptNever:
|
||||
case "":
|
||||
allErrors = append(allErrors, field.Required(fldPath, ""))
|
||||
default:
|
||||
validValues := []string{string(core.PreemptLowerPriority), string(core.PreemptNever)}
|
||||
allErrors = append(allErrors, field.NotSupported(fldPath, preemptionPolicy, validValues))
|
||||
}
|
||||
return allErrors
|
||||
}
|
||||
|
||||
func validateDNSPolicy(dnsPolicy *core.DNSPolicy, fldPath *field.Path) field.ErrorList {
|
||||
allErrors := field.ErrorList{}
|
||||
switch *dnsPolicy {
|
||||
@@ -3033,6 +3046,10 @@ func ValidatePodSpec(spec *core.PodSpec, fldPath *field.Path) field.ErrorList {
|
||||
allErrs = append(allErrs, ValidateRuntimeClassName(*spec.RuntimeClassName, fldPath.Child("runtimeClassName"))...)
|
||||
}
|
||||
|
||||
if spec.PreemptionPolicy != nil {
|
||||
allErrs = append(allErrs, ValidatePreemptionPolicy(spec.PreemptionPolicy, fldPath.Child("preemptionPolicy"))...)
|
||||
}
|
||||
|
||||
return allErrs
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user