code: func ValidatePod(pod *core.Pod) field.ErrorList {
  	fldPath := field.NewPath("metadata")
  	allErrs := ValidateObjectMeta(&pod.ObjectMeta, true, ValidatePodName, fldPath)
  	allErrs = append(allErrs, ValidatePodSpecificAnnotations(pod.ObjectMeta.Annotations, &pod.Spec, fldPath.Child("annotations"))...)
  	allErrs = append(allErrs, ValidatePodSpec(&pod.Spec, field.NewPath("spec"))...)
  
  	// we do additional validation only pertinent for pods and not pod templates
  	// this was done to preserve backwards compatibility
  	specPath := field.NewPath("spec")
  
  	if pod.Spec.ServiceAccountName == "" {
  		for vi, volume := range pod.Spec.Volumes {
  			path := specPath.Child("volumes").Index(vi).Child("projected")
  			if volume.Projected != nil {
  				for si, source := range volume.Projected.Sources {
  					saPath := path.Child("sources").Index(si).Child("serviceAccountToken")
  					if source.ServiceAccountToken != nil {
  						allErrs = append(allErrs, field.Forbidden(saPath, "must not be specified when serviceAccountName is not set"))
  					}
  				}
  			}
  		}
  	}
  
  	allErrs = append(allErrs, validateContainersOnlyForPod(pod.Spec.Containers, specPath.Child("containers"))...)
  	allErrs = append(allErrs, validateContainersOnlyForPod(pod.Spec.InitContainers, specPath.Child("initContainers"))...)
  
  	hugePageResources := sets.NewString()
  	for i := range pod.Spec.Containers {
  		resourceSet := toContainerResourcesSet(&pod.Spec.Containers[i])
  		for resourceStr := range resourceSet {
  			if v1helper.IsHugePageResourceName(v1.ResourceName(resourceStr)) {
  				hugePageResources.Insert(resourceStr)
  			}
  		}
  	}
  	if len(hugePageResources) > 1 {
  		allErrs = append(allErrs, field.Invalid(specPath, hugePageResources, "must use a single hugepage size in a pod spec"))
  	}
  
  	return allErrs
  }
docs: // ValidatePod tests if required fields in the pod are set.