mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Merge pull request #19520 from janetkuo/deployment-expectation-fix
Fix e2e flake: Fix incorrect expectation when deployment scaling down old rcs
This commit is contained in:
		@@ -633,6 +633,7 @@ func (dc *DeploymentController) reconcileOldRCs(allRCs []*api.ReplicationControl
 | 
			
		||||
		return false, nil
 | 
			
		||||
	}
 | 
			
		||||
	totalScaleDownCount := readyPodCount - minAvailable
 | 
			
		||||
	totalScaledDown := 0
 | 
			
		||||
	for _, targetRC := range oldRCs {
 | 
			
		||||
		if totalScaleDownCount == 0 {
 | 
			
		||||
			// No further scaling required.
 | 
			
		||||
@@ -649,14 +650,16 @@ func (dc *DeploymentController) reconcileOldRCs(allRCs []*api.ReplicationControl
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return false, err
 | 
			
		||||
		}
 | 
			
		||||
		totalScaledDown += scaleDownCount
 | 
			
		||||
		totalScaleDownCount -= scaleDownCount
 | 
			
		||||
		dKey, err := controller.KeyFunc(&deployment)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return false, fmt.Errorf("Couldn't get key for deployment %#v: %v", deployment, err)
 | 
			
		||||
		}
 | 
			
		||||
		if expectationsCheck {
 | 
			
		||||
			dc.podExpectations.ExpectDeletions(dKey, scaleDownCount)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	// Expect to see old rcs scaled down by exactly totalScaledDownCount (sum of scaleDownCount) replicas.
 | 
			
		||||
	dKey, err = controller.KeyFunc(&deployment)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return false, fmt.Errorf("Couldn't get key for deployment %#v: %v", deployment, err)
 | 
			
		||||
	}
 | 
			
		||||
	if expectationsCheck {
 | 
			
		||||
		dc.podExpectations.ExpectDeletions(dKey, totalScaledDown)
 | 
			
		||||
	}
 | 
			
		||||
	return true, err
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user