code: func ValidatePodSpec(spec *api.PodSpec, fldPath *field.Path) field.ErrorList {
  	allErrs := field.ErrorList{}
  
  	allVolumes, vErrs := validateVolumes(spec.Volumes, fldPath.Child("volumes"))
  	allErrs = append(allErrs, vErrs...)
  	allErrs = append(allErrs, validateContainers(spec.Containers, allVolumes, fldPath.Child("containers"))...)
  	allErrs = append(allErrs, validateRestartPolicy(&spec.RestartPolicy, fldPath.Child("restartPolicy"))...)
  	allErrs = append(allErrs, validateDNSPolicy(&spec.DNSPolicy, fldPath.Child("dnsPolicy"))...)
  	allErrs = append(allErrs, ValidateLabels(spec.NodeSelector, fldPath.Child("nodeSelector"))...)
  	allErrs = append(allErrs, ValidatePodSecurityContext(spec.SecurityContext, spec, fldPath, fldPath.Child("securityContext"))...)
  	allErrs = append(allErrs, validateImagePullSecrets(spec.ImagePullSecrets, fldPath.Child("imagePullSecrets"))...)
  	if len(spec.ServiceAccountName) > 0 {
  		if ok, msg := ValidateServiceAccountName(spec.ServiceAccountName, false); !ok {
  			allErrs = append(allErrs, field.Invalid(fldPath.Child("serviceAccountName"), spec.ServiceAccountName, msg))
  		}
  	}
  
  	if len(spec.NodeName) > 0 {
  		if ok, msg := ValidateNodeName(spec.NodeName, false); !ok {
  			allErrs = append(allErrs, field.Invalid(fldPath.Child("nodeName"), spec.NodeName, msg))
  		}
  	}
  
  	if spec.ActiveDeadlineSeconds != nil {
  		if *spec.ActiveDeadlineSeconds <= 0 {
  			allErrs = append(allErrs, field.Invalid(fldPath.Child("activeDeadlineSeconds"), spec.ActiveDeadlineSeconds, "must be greater than 0"))
  		}
  	}
  	return allErrs
  }
docs: // ValidatePodSpec tests that the specified PodSpec has valid data.
  // This includes checking formatting and uniqueness.  It also canonicalizes the
  // structure by setting default values and implementing any backwards-compatibility
  // tricks.