code: func (dsc *DaemonSetsController) getDaemonPods(ds *apps.DaemonSet) ([]*v1.Pod, error) {
  	selector, err := metav1.LabelSelectorAsSelector(ds.Spec.Selector)
  	if err != nil {
  		return nil, err
  	}
  
  	// List all pods to include those that don't match the selector anymore but
  	// have a ControllerRef pointing to this controller.
  	pods, err := dsc.podLister.Pods(ds.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).
  	dsNotDeleted := controller.RecheckDeletionTimestamp(func() (metav1.Object, error) {
  		fresh, err := dsc.kubeClient.AppsV1().DaemonSets(ds.Namespace).Get(ds.Name, metav1.GetOptions{})
  		if err != nil {
  			return nil, err
  		}
  		if fresh.UID != ds.UID {
  			return nil, fmt.Errorf("original DaemonSet %v/%v is gone: got uid %v, wanted %v", ds.Namespace, ds.Name, fresh.UID, ds.UID)
  		}
  		return fresh, nil
  	})
  
  	// Use ControllerRefManager to adopt/orphan as needed.
  	cm := controller.NewPodControllerRefManager(dsc.podControl, ds, selector, controllerKind, dsNotDeleted)
  	return cm.ClaimPods(pods)
  }
docs: // getDaemonPods returns daemon pods owned by the given ds.
  // This also reconciles ControllerRef by adopting/orphaning.
  // Note that returned Pods are pointers to objects in the cache.
  // If you want to modify one, you need to deep-copy it first.