code: func ValidateStatefulSetUpdate(statefulSet, oldStatefulSet *apps.StatefulSet) field.ErrorList {
  	allErrs := apivalidation.ValidateObjectMetaUpdate(&statefulSet.ObjectMeta, &oldStatefulSet.ObjectMeta, field.NewPath("metadata"))
  
  	restoreReplicas := statefulSet.Spec.Replicas
  	statefulSet.Spec.Replicas = oldStatefulSet.Spec.Replicas
  
  	restoreTemplate := statefulSet.Spec.Template
  	statefulSet.Spec.Template = oldStatefulSet.Spec.Template
  
  	restoreStrategy := statefulSet.Spec.UpdateStrategy
  	statefulSet.Spec.UpdateStrategy = oldStatefulSet.Spec.UpdateStrategy
  
  	if !apiequality.Semantic.DeepEqual(statefulSet.Spec, oldStatefulSet.Spec) {
  		allErrs = append(allErrs, field.Forbidden(field.NewPath("spec"), "updates to statefulset spec for fields other than 'replicas', 'template', and 'updateStrategy' are forbidden"))
  	}
  	statefulSet.Spec.Replicas = restoreReplicas
  	statefulSet.Spec.Template = restoreTemplate
  	statefulSet.Spec.UpdateStrategy = restoreStrategy
  
  	allErrs = append(allErrs, apivalidation.ValidateNonnegativeField(int64(statefulSet.Spec.Replicas), field.NewPath("spec", "replicas"))...)
  	return allErrs
  }
docs: // ValidateStatefulSetUpdate tests if required fields in the StatefulSet are set.