@@ -72,14 +72,14 @@ func (dc *DeploymentController) reconcileNewReplicaSet(ctx context.Context, allR
7272 }
7373 if * (newRS .Spec .Replicas ) > * (deployment .Spec .Replicas ) {
7474 // Scale down.
75- scaled , _ , err := dc .scaleReplicaSetAndRecordEvent (ctx , newRS , * (deployment .Spec .Replicas ), deployment )
75+ scaled , _ , err := dc .scaleReplicaSetWithLazyAnnotationUpdate (ctx , newRS , * (deployment .Spec .Replicas ), deployment )
7676 return scaled , err
7777 }
7878 newReplicasCount , err := deploymentutil .NewRSNewReplicas (deployment , allRSs , newRS )
7979 if err != nil {
8080 return false , err
8181 }
82- scaled , _ , err := dc .scaleReplicaSetAndRecordEvent (ctx , newRS , newReplicasCount , deployment )
82+ scaled , _ , err := dc .scaleReplicaSetWithLazyAnnotationUpdate (ctx , newRS , newReplicasCount , deployment )
8383 return scaled , err
8484}
8585
@@ -178,7 +178,7 @@ func (dc *DeploymentController) cleanupUnhealthyReplicas(ctx context.Context, ol
178178 if newReplicasCount > * (targetRS .Spec .Replicas ) {
179179 return nil , 0 , fmt .Errorf ("when cleaning up unhealthy replicas, got invalid request to scale down %s/%s %d -> %d" , targetRS .Namespace , targetRS .Name , * (targetRS .Spec .Replicas ), newReplicasCount )
180180 }
181- _ , updatedOldRS , err := dc .scaleReplicaSetAndRecordEvent (ctx , targetRS , newReplicasCount , deployment )
181+ _ , updatedOldRS , err := dc .scaleReplicaSetWithLazyAnnotationUpdate (ctx , targetRS , newReplicasCount , deployment )
182182 if err != nil {
183183 return nil , totalScaledDown , err
184184 }
@@ -223,7 +223,7 @@ func (dc *DeploymentController) scaleDownOldReplicaSetsForRollingUpdate(ctx cont
223223 if newReplicasCount > * (targetRS .Spec .Replicas ) {
224224 return 0 , fmt .Errorf ("when scaling down old RS, got invalid request to scale down %s/%s %d -> %d" , targetRS .Namespace , targetRS .Name , * (targetRS .Spec .Replicas ), newReplicasCount )
225225 }
226- _ , _ , err := dc .scaleReplicaSetAndRecordEvent (ctx , targetRS , newReplicasCount , deployment )
226+ _ , _ , err := dc .scaleReplicaSetWithLazyAnnotationUpdate (ctx , targetRS , newReplicasCount , deployment )
227227 if err != nil {
228228 return totalScaledDown , err
229229 }
0 commit comments