Merge pull request #9688 from liggitt/validate_pod_spec

Validate service account name in pod spec
This commit is contained in:
Satnam Singh
2015-06-18 17:18:09 -07:00
2 changed files with 12 additions and 0 deletions

View File

@@ -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 {