code: func (dsc *DaemonSetsController) rollingUpdate(ds *apps.DaemonSet, nodeList []*v1.Node, hash string) error {
  	nodeToDaemonPods, err := dsc.getNodesToDaemonPods(ds)
  	if err != nil {
  		return fmt.Errorf("couldn't get node to daemon pod mapping for daemon set %q: %v", ds.Name, err)
  	}
  
  	_, oldPods := dsc.getAllDaemonSetPods(ds, nodeToDaemonPods, hash)
  	maxUnavailable, numUnavailable, err := dsc.getUnavailableNumbers(ds, nodeList, nodeToDaemonPods)
  	if err != nil {
  		return fmt.Errorf("Couldn't get unavailable numbers: %v", err)
  	}
  	oldAvailablePods, oldUnavailablePods := util.SplitByAvailablePods(ds.Spec.MinReadySeconds, oldPods)
  
  	// for oldPods delete all not running pods
  	var oldPodsToDelete []string
  	klog.V(4).Infof("Marking all unavailable old pods for deletion")
  	for _, pod := range oldUnavailablePods {
  		// Skip terminating pods. We won't delete them again
  		if pod.DeletionTimestamp != nil {
  			continue
  		}
  		klog.V(4).Infof("Marking pod %s/%s for deletion", ds.Name, pod.Name)
  		oldPodsToDelete = append(oldPodsToDelete, pod.Name)
  	}
  
  	klog.V(4).Infof("Marking old pods for deletion")
  	for _, pod := range oldAvailablePods {
  		if numUnavailable >= maxUnavailable {
  			klog.V(4).Infof("Number of unavailable DaemonSet pods: %d, is equal to or exceeds allowed maximum: %d", numUnavailable, maxUnavailable)
  			break
  		}
  		klog.V(4).Infof("Marking pod %s/%s for deletion", ds.Name, pod.Name)
  		oldPodsToDelete = append(oldPodsToDelete, pod.Name)
  		numUnavailable++
  	}
  	return dsc.syncNodes(ds, oldPodsToDelete, []string{}, hash)
  }
docs: // rollingUpdate deletes old daemon set pods making sure that no more than
  // ds.Spec.UpdateStrategy.RollingUpdate.MaxUnavailable pods are unavailable