Skip to content

Commit e8a5092

Browse files
authored
[release-1.13] Reset the Spec.InitialRevisions for RolloutOrchestrator the when route traffic is empty (#156)
* [release-1.13] Reset the Spec.InitialRevisions for RolloutOrchestrator the when route traffic is empty * Added the test cases
1 parent 9441959 commit e8a5092

File tree

2 files changed

+698
-44
lines changed

2 files changed

+698
-44
lines changed

pkg/reconciler/service/resources/rolloutorchestrator.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,8 @@ func NewInitialFinalTargetRev(initialRevisionStatus, ultimateRevisionTarget []v1
228228
}
229229

230230
// UpdateInitialFinalTargetRev updates InitialRevisions, TargetRevisions and StageTargetRevisions for RolloutOrchestrator.
231+
// Param: ultimateRevisionTarget is the most updated target revisions.
232+
// Param: ro is the custom resource of RolloutOrchestrator.
231233
func UpdateInitialFinalTargetRev(ultimateRevisionTarget []v1.TargetRevision, ro *v1.RolloutOrchestrator,
232234
route *servingv1.Route, deploymentLister appsv1listers.DeploymentLister) {
233235
if !trafficEqual(ro.Spec.TargetRevisions, ultimateRevisionTarget) {
@@ -267,7 +269,8 @@ func UpdateInitialFinalTargetRev(ultimateRevisionTarget []v1.TargetRevision, ro
267269
}
268270
}
269271
}
270-
} else {
272+
} else if route == nil || len(route.Status.Traffic) == 0 {
273+
// If route.Status.Traffic is empty, no revision is assigned to any traffic, and reset the InitialRevisions.
271274
// Reset the InitialRevisions, if StageRevisionStatus in the status is empty.
272275
ro.Spec.InitialRevisions = nil
273276
}

0 commit comments

Comments
 (0)