@@ -938,39 +938,42 @@ func convertIntoTrafficTarget(name string, ro *v1.RolloutOrchestrator, rc *Rollo
938
938
// The name is the same as the revision name.
939
939
spaTargetRevName := targetRevName
940
940
targetNumberReplicas , minScale := finalTargetRevs [0 ].MinScale , finalTargetRevs [0 ].MinScale
941
- var minScalingDown * int32
942
- targetNameScalingDown := ""
943
- var targetReplicasPercentage * int64
941
+
942
+ // Comment out the following lines for further consideration with resourceUtil mode
943
+ //var minScalingDown *int32
944
+ //targetNameScalingDown := ""
945
+ //var targetReplicasPercentage *int64
944
946
945
947
// Find the target number of replicas for the current stage.
946
948
for _ , revision := range ro .Spec .StageTargetRevisions {
947
949
if revision .RevisionName == spaTargetRevName && revision .TargetReplicas != nil {
948
950
targetNumberReplicas = revision .TargetReplicas
949
- targetReplicasPercentage = revision .Percent
951
+ // targetReplicasPercentage = revision.Percent
950
952
}
951
953
952
- if revision .Direction == v1 .DirectionDown {
953
- targetNameScalingDown = revision .RevisionName
954
- minScalingDown = revision .MinScale
955
- }
954
+ // if revision.Direction == v1.DirectionDown {
955
+ // targetNameScalingDown = revision.RevisionName
956
+ // minScalingDown = revision.MinScale
957
+ // }
956
958
}
957
959
958
960
// Verify if the revision scaling down is traffic driven or not.
959
- spa , err := spaLister .Get (targetNameScalingDown )
960
- trafficDriven := true
961
-
962
- if apierrs .IsNotFound (err ) || (err == nil && ((spa .Status .ActualScale != nil && minScalingDown != nil &&
963
- * spa .Status .ActualScale <= * minScalingDown ) ||
964
- (spa .Status .ActualScale != nil && * spa .Status .ActualScale == 0 && minScalingDown == nil ))) {
965
- trafficDriven = false
966
- }
967
-
968
- lastStage := false
969
- if targetReplicasPercentage != nil && * targetReplicasPercentage == 100 {
970
- lastStage = true
971
- }
972
-
973
- spa , err = spaLister .Get (spaTargetRevName )
961
+ // Comment out the following lines for further consideration with resourceUtil mode
962
+ //spa, err := spaLister.Get(targetNameScalingDown)
963
+ //trafficDriven := true
964
+ //
965
+ //if apierrs.IsNotFound(err) || (err == nil && ((spa.Status.ActualScale != nil && minScalingDown != nil &&
966
+ // *spa.Status.ActualScale <= *minScalingDown) ||
967
+ // (spa.Status.ActualScale != nil && *spa.Status.ActualScale == 0 && minScalingDown == nil))) {
968
+ // trafficDriven = false
969
+ //}
970
+ //
971
+ //lastStage := false
972
+ //if targetReplicasPercentage != nil && *targetReplicasPercentage == 100 {
973
+ // lastStage = true
974
+ //}
975
+
976
+ spa , err := spaLister .Get (spaTargetRevName )
974
977
// Check the number of replicas has reached the target number of replicas for the revision scaling up
975
978
if apierrs .IsNotFound (err ) || (err == nil && targetNumberReplicas != nil && spa .Status .ActualScale != nil &&
976
979
minScale != nil && * targetNumberReplicas <= * minScale && * spa .Status .ActualScale < * targetNumberReplicas ) {
@@ -980,8 +983,9 @@ func convertIntoTrafficTarget(name string, ro *v1.RolloutOrchestrator, rc *Rollo
980
983
// However, if there is no issue getting yhe spa, and the actual number of replicas is less than
981
984
// the target number of replicas, we need to use ro.Status.StageRevisionStatus or route.Status.Traffic
982
985
// as the traffic information for the route.
983
- if strings .EqualFold (rc .ProgressiveRolloutStrategy , strategies .AvailabilityStrategy ) ||
984
- (strings .EqualFold (rc .ProgressiveRolloutStrategy , strategies .ResourceUtilStrategy ) && ! trafficDriven && ! lastStage ) {
986
+ if strings .EqualFold (rc .ProgressiveRolloutStrategy , strategies .AvailabilityStrategy ) {
987
+ // Comment out the following lines for further consideration with resourceUtil mode
988
+ // || (strings.EqualFold(rc.ProgressiveRolloutStrategy, strategies.ResourceUtilStrategy) && !trafficDriven && !lastStage) {
985
989
if len (ro .Status .StageRevisionStatus ) > 0 {
986
990
// If the ro has the StageRevisionStatus in the status, use it.
987
991
revisionTarget = ro .Status .StageRevisionStatus
0 commit comments