code: func (ssc *StatefulSetController) getPodsForStatefulSet(set *apps.StatefulSet, selector labels.Selector) ([]*v1.Pod, error) {
  	// List all pods to include the pods that don't match the selector anymore but
  	// has a ControllerRef pointing to this StatefulSet.
  	pods, err := ssc.podLister.Pods(set.Namespace).List(labels.Everything())
  	if err != nil {
  		return nil, err
  	}
  
  	filter := func(pod *v1.Pod) bool {
  		// Only claim if it matches our StatefulSet name. Otherwise release/ignore.
  		return isMemberOf(set, pod)
  	}
  
  	// If any adoptions are attempted, we should first recheck for deletion with
  	// an uncached quorum read sometime after listing Pods (see #42639).
  	canAdoptFunc := controller.RecheckDeletionTimestamp(func() (metav1.Object, error) {
  		fresh, err := ssc.kubeClient.AppsV1().StatefulSets(set.Namespace).Get(set.Name, metav1.GetOptions{})
  		if err != nil {
  			return nil, err
  		}
  		if fresh.UID != set.UID {
  			return nil, fmt.Errorf("original StatefulSet %v/%v is gone: got uid %v, wanted %v", set.Namespace, set.Name, fresh.UID, set.UID)
  		}
  		return fresh, nil
  	})
  
  	cm := controller.NewPodControllerRefManager(ssc.podControl, set, selector, controllerKind, canAdoptFunc)
  	return cm.ClaimPods(pods, filter)
  }
docs: // getPodsForStatefulSet returns the Pods that a given StatefulSet should manage.
  // It also reconciles ControllerRef by adopting/orphaning.
  //
  // NOTE: Returned Pods are pointers to objects from the cache.
  //       If you need to modify one, you need to copy it first.