code: func ValidatePodTemplateSpecForStatefulSet(template *api.PodTemplateSpec, selector labels.Selector, fldPath *field.Path) field.ErrorList {
  	allErrs := field.ErrorList{}
  	if template == nil {
  		allErrs = append(allErrs, field.Required(fldPath, ""))
  	} else {
  		if !selector.Empty() {
  			// Verify that the StatefulSet selector matches the labels in template.
  			labels := labels.Set(template.Labels)
  			if !selector.Matches(labels) {
  				allErrs = append(allErrs, field.Invalid(fldPath.Child("metadata", "labels"), template.Labels, "`selector` does not match template `labels`"))
  			}
  		}
  		// TODO: Add validation for PodSpec, currently this will check volumes, which we know will
  		// fail. We should really check that the union of the given volumes and volumeClaims match
  		// volume mounts in the containers.
  		// allErrs = append(allErrs, apivalidation.ValidatePodTemplateSpec(template, fldPath)...)
  		allErrs = append(allErrs, unversionedvalidation.ValidateLabels(template.Labels, fldPath.Child("labels"))...)
  		allErrs = append(allErrs, apivalidation.ValidateAnnotations(template.Annotations, fldPath.Child("annotations"))...)
  		allErrs = append(allErrs, apivalidation.ValidatePodSpecificAnnotations(template.Annotations, &template.Spec, fldPath.Child("annotations"))...)
  	}
  	return allErrs
  }
docs: // ValidatePodTemplateSpecForStatefulSet validates the given template and ensures that it is in accordance with the desired selector.