code: func (jm *JobController) getPodsForJob(j *batch.Job) ([]*v1.Pod, error) {
  	selector, err := metav1.LabelSelectorAsSelector(j.Spec.Selector)
  	if err != nil {
  		return nil, fmt.Errorf("couldn't convert Job selector: %v", err)
  	}
  	// List all pods to include those that don't match the selector anymore
  	// but have a ControllerRef pointing to this controller.
  	pods, err := jm.podStore.Pods(j.Namespace).List(labels.Everything())
  	if err != nil {
  		return nil, err
  	}
  	// 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 := jm.kubeClient.BatchV1().Jobs(j.Namespace).Get(j.Name, metav1.GetOptions{})
  		if err != nil {
  			return nil, err
  		}
  		if fresh.UID != j.UID {
  			return nil, fmt.Errorf("original Job %v/%v is gone: got uid %v, wanted %v", j.Namespace, j.Name, fresh.UID, j.UID)
  		}
  		return fresh, nil
  	})
  	cm := controller.NewPodControllerRefManager(jm.podControl, j, selector, controllerKind, canAdoptFunc)
  	return cm.ClaimPods(pods)
  }
docs: // getPodsForJob returns the set of pods that this Job should manage.
  // It also reconciles ControllerRef by adopting/orphaning.
  // Note that the returned Pods are pointers into the cache.