code: func (dsc *DaemonSetsController) controlledHistories(ds *apps.DaemonSet) ([]*apps.ControllerRevision, error) {
  	selector, err := metav1.LabelSelectorAsSelector(ds.Spec.Selector)
  	if err != nil {
  		return nil, err
  	}
  
  	// List all histories to include those that don't match the selector anymore
  	// but have a ControllerRef pointing to the controller.
  	histories, err := dsc.historyLister.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 := 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.NewControllerRevisionControllerRefManager(dsc.crControl, ds, selector, controllerKind, canAdoptFunc)
  	return cm.ClaimControllerRevisions(histories)
  }
docs: // controlledHistories returns all ControllerRevisions controlled by the given DaemonSet.
  // This also reconciles ControllerRef by adopting/orphaning.
  // Note that returned histories are pointers to objects in the cache.
  // If you want to modify one, you need to deep-copy it first.