Release mode processing for the route not being ready.#2948
Release mode processing for the route not being ready.#2948knative-prow-robot merged 12 commits intoknative:masterfrom
Conversation
When we update the service in the release mode, but the route is not yet updated to the new version, we should mark the service to be in `Unknown` ready state. See: knative#2430
| // This is important because the copy we loaded from the informer's | ||
| // cache may be stale and we don't want to overwrite a prior update | ||
| // to status with this stale state. | ||
|
|
There was a problem hiding this comment.
did you mean to delete this line? If so, . on the previous line?
There was a problem hiding this comment.
No I did not. Probably one of those vscode vim bindings random actions.
| if len(rs.Traffic) == 0 || rs.Traffic[0].RevisionName != revs[0] { | ||
| c.Logger.Debugf("%s: traffic not yet migrated to %s", s.Name, revs[0]) | ||
| s.Status.MarkRouteNotYetReady() | ||
| } |
There was a problem hiding this comment.
I feel like there's an uncovered path through here when I go from:
revisions: ["rev1", "rev2"]
percent: 0to:
revisions: ["rev1", "rev3"]
percent: 0We only check that "current" matches, not that "candidate" matches.
There was a problem hiding this comment.
Well, that's why I left the comment. Since this does not affect the traffic — should it matter?
If you think it does, then it's just reorganization of code.
| runLatestCheckTrafficMigrated(ss, &route.Status, &config.Status) | ||
| c.runLatestCheckTrafficMigrated(service, &route.Status, &config.Status) | ||
| case service.Spec.Release != nil: | ||
| c.releaseCheckTrafficMigrated(service, &route.Status, &config.Status) |
There was a problem hiding this comment.
Couldn't we replace this whole switch (and both functions) with:
if rc := service.Status.GetCondition(v1alpha1.ServiceConditionRoutesReady); rc != nil && rc.Status == corev1.ConditionTrue {
want := route.Spec.Traffic.DeepCopy()
for idx := range want {
if want[idx].ConfigurationName == config.Name {
want[idx].RevisionName = config.LatestReadyConfigurationName
want[idx].ConfigurationName = ""
}
}
if got := route.Status.Traffic; !cmp.Equal(got, want) {
s.Status.MarkRouteNotYetReady()
}
}There was a problem hiding this comment.
Don't know. Have to think more about this. May be.
There was a problem hiding this comment.
As is this definitely makes old tests fail. New tests still pass.
I can try to tweak it a bit.
There was a problem hiding this comment.
FWIW cmp.Equal can panic. If you go with this approach, consider: https://github.com/knative/pkg/blob/2a1c043ce3d778a4017e9c988b7a7dd0644312ad/kmp/diff.go#L53
There was a problem hiding this comment.
- Had to update other tests, since they were reflecting just part of the reality;
- implemented Matt's suggestion;
- implemented Jon's suggestion.
🍷
|
/test pull-knative-serving-go-coverage |
|
PTAL> |
| switch { | ||
| case service.Spec.RunLatest != nil: | ||
| runLatestCheckTrafficMigrated(ss, &route.Status, &config.Status) | ||
| if service.Spec.RunLatest != nil || service.Spec.Release != nil { |
There was a problem hiding this comment.
I think I would prefer service.Spec.Manual == nil as it is the only mode that we don't reconcile. Even though pinned is deprecated I don't think there is a strong reason to explicitly exclude it here, and checking that we are not manual enables any future modes to just work.
There was a problem hiding this comment.
Well there's still pinned, it's deprecated, but supported.
There was a problem hiding this comment.
Yeah, but it's a nop for Pinned. I think I have a mild preference for Manual != nil as well because if we were to add a new mode, this would either do the right thing or the author would have to adjust this logic for the Service to become Ready.
There was a problem hiding this comment.
Doesn't matter at all, since we don't reconcile manual anyway.
There was a problem hiding this comment.
So we don't reconcile if we're in manual, so I removed the check altogether.
Since reconcile() is only invoked, when we're not in manual mode, hence the type check is useless here. Also move the DeepCopy() one word right, saving us a few microseconds.
|
The following is the coverage report on pkg/.
|
|
/lgtm |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mattmoor, vagababov The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Fixes #2430
Proposed Changes