code: func (dc *DeploymentController) rolloutRolling(d *apps.Deployment, rsList []*apps.ReplicaSet) error {
  	newRS, oldRSs, err := dc.getAllReplicaSetsAndSyncRevision(d, rsList, true)
  	if err != nil {
  		return err
  	}
  	allRSs := append(oldRSs, newRS)
  
  	// Scale up, if we can.
  	scaledUp, err := dc.reconcileNewReplicaSet(allRSs, newRS, d)
  	if err != nil {
  		return err
  	}
  	if scaledUp {
  		// Update DeploymentStatus
  		return dc.syncRolloutStatus(allRSs, newRS, d)
  	}
  
  	// Scale down, if we can.
  	scaledDown, err := dc.reconcileOldReplicaSets(allRSs, controller.FilterActiveReplicaSets(oldRSs), newRS, d)
  	if err != nil {
  		return err
  	}
  	if scaledDown {
  		// Update DeploymentStatus
  		return dc.syncRolloutStatus(allRSs, newRS, d)
  	}
  
  	if deploymentutil.DeploymentComplete(d, &d.Status) {
  		if err := dc.cleanupDeployment(oldRSs, d); err != nil {
  			return err
  		}
  	}
  
  	// Sync deployment status
  	return dc.syncRolloutStatus(allRSs, newRS, d)
  }
docs: // rolloutRolling implements the logic for rolling a new replica set.