code: func ValidateContainerStateTransition(newStatuses, oldStatuses []core.ContainerStatus, fldpath *field.Path, restartPolicy core.RestartPolicy) field.ErrorList {
  	allErrs := field.ErrorList{}
  	// If we should always restart, containers are allowed to leave the terminated state
  	if restartPolicy == core.RestartPolicyAlways {
  		return allErrs
  	}
  	for i, oldStatus := range oldStatuses {
  		// Skip any container that is not terminated
  		if oldStatus.State.Terminated == nil {
  			continue
  		}
  		// Skip any container that failed but is allowed to restart
  		if oldStatus.State.Terminated.ExitCode != 0 && restartPolicy == core.RestartPolicyOnFailure {
  			continue
  		}
  		for _, newStatus := range newStatuses {
  			if oldStatus.Name == newStatus.Name && newStatus.State.Terminated == nil {
  				allErrs = append(allErrs, field.Forbidden(fldpath.Index(i).Child("state"), "may not be transitioned to non-terminated state"))
  			}
  		}
  	}
  	return allErrs
  }
docs: // ValidateContainerStateTransition test to if any illegal container state transitions are being attempted