Merge pull request #9688 from liggitt/validate_pod_spec
Validate service account name in pod spec
This commit is contained in:
@@ -963,6 +963,11 @@ func ValidatePodSpec(spec *api.PodSpec) errs.ValidationErrorList {
|
||||
allErrs = append(allErrs, ValidateLabels(spec.NodeSelector, "nodeSelector")...)
|
||||
allErrs = append(allErrs, validateHostNetwork(spec.HostNetwork, spec.Containers).Prefix("hostNetwork")...)
|
||||
allErrs = append(allErrs, validateImagePullSecrets(spec.ImagePullSecrets).Prefix("imagePullSecrets")...)
|
||||
if len(spec.ServiceAccount) > 0 {
|
||||
if ok, msg := ValidateServiceAccountName(spec.ServiceAccount, false); !ok {
|
||||
allErrs = append(allErrs, errs.NewFieldInvalid("serviceAccount", spec.ServiceAccount, msg))
|
||||
}
|
||||
}
|
||||
|
||||
if spec.ActiveDeadlineSeconds != nil {
|
||||
if *spec.ActiveDeadlineSeconds <= 0 {
|
||||
|
Reference in New Issue
Block a user