Repository navigation
Description
cc @mattmoor @dgerd @sixolet @steren @shefaliv @mikehelmick @evankanderson
tl;dr this issue describes a scenario where the Service reports Ready=True before rollout is complete, and proposes a change (possibly with a new condition) that allows reporting Readiness more correctly.
Problem Statement
Consider this runLatest Service scenario - what should Service's Ready condition = in this case?
kind: Service
metadata:
name: myservice
generation: 2
...
spec:
runLatest:
...
status:
conditions:
- type: Ready
status: ?
- type: ConfigurationsReady
status: True
- type: RoutesReady
status: True
observedGeneration: 2
latestCreatedRevisionName: myservice.2
latestReadyRevisionName: myservice.2 # Configuration is True based on new revision
traffic:
- revisionName: myservice.1 # Route is True based on the previous revision
percent: 100In this case, by the Knative conditions convention, the Service should be Ready=True because ConfigurationsReady = True and RoutesReady = True.
But in reality, what has happened is that the rollout is still in progress. The Configuration has reconciled and successfully created the new myservice.2, and becomes true, but the Route has not yet been notified of the updated revision and migrated traffic to it. It is still on the old revision. So the client's intent in updating the service is only partially complete.
The client is prematurely notified that their deployment is finished, but in reality traffic has not migrated yet.
Proposal(s)
To address this, a suggestion is to compare the status.latestReadyRevisionName (which is propagated from the Configuration) and the status.traffic.revisionName (which is propagated from the Route) to determine overall readiness.
One possibility is that Service's Ready condition is no longer simply the AND of RoutesReady & ConfigurationsReady terminal conditions. Instead Service's Ready is based on RoutesReady = True AND ConfigurationsReady = True AND the latestReadyRevisionName = traffic.revisionName.
Doing so could lead to conditions like this:
..
status:
conditions:
- type: Ready
status: Unknown
message: "Traffic migration is not complete"
- type: ConfigurationsReady
status: True
- type: RoutesReady
status: True
...Another alternative is to leave the Ready condition as a conventional rollup of terminal conditions, and introduce a third terminal condition named something like RolloutComplete. RolloutComplete would encode the latestReadyRevisionName = traffic.revisionName test. This is recomputed with updates from the Configuration and Route. This would lead to conditions like:
..
status:
conditions:
- type: Ready
status: Unknown
message: "Traffic migration is not complete"
- type: RolloutComplete
status: Unknown
message: "Traffic migration is not complete"
- type: ConfigurationsReady
status: True
- type: RoutesReady
status: True
...Note that in either of these suggestions, the logic would be slightly different in Release mode, where the traffic in the spec of the Service (i.e. named revisions and percentages) is compared with the traffic in status.
Activity
[-]Service is only reports Ready=True when rollout is complete[/-][+]Service only reports Ready=True when rollout is complete[/+]mattmoor commentedon Nov 8, 2018
I added this to the future topics for the WG. Are you up for leading a discussion next week @cooperneil ?
cooperneil commentedon Nov 16, 2018
Missed the WG discussion on Wednesday, but heard there was discussion of if the logic should be in the Route rather than Service. I think it needs to at least be in the Service, due to the race condition of a Service being notified of a Configuration update before the Route being notified.
In this scenario, if the logic was only in the Route, I think it would have a stale positive indicating its traffic was current, and therefore the Service would prematurely report ready.
dgerd commentedon Nov 16, 2018
cooperneil commentedon Nov 18, 2018
Oh, got it. So in that 3rd option, the RoutesReady and ConfigurationsReady remain terminal conditions, and the conditions would look like:
I think I actually prefer that to the other 2 alternatives. Thoughts?
mattmoor commentedon Dec 10, 2018
/kind bug
/assign @dgerd
So I believe that this is more or less the root cause of a flake I am seeing in our conformance testing (e.g.).
This logic here only waits for the Service's
LatestReadyRevisionNameto reflect the latest rollout, and then it immediately checks that (not waits for) the Route looks a particular way.This leads to the intermittent error in CI:
cc @adrcunha
cooperneil commentedon Dec 10, 2018
So of the 3 options outlined, what do we think the right approach is? I'm happy with either options 2 or 3, i.e.
dgerd commentedon Dec 10, 2018
I was originally more in favor of Option 2 as I liked the properties that:
However, I am coming around to Option 3. I think we can accurately capture the state through
messageandreasonfields so that it is clear that the Route is ready, but transitioning to a new revision. Meanwhile keeping the terminal conditions to just the Service and dependent objects reduces the number of conditions to keep track of both in code and in UI. If for some reason we end up unhappy with Option 3 we can always add a new condition later (although we would have to be careful changing the new RouteReady behavior if clients end up relying on it).dgerd commentedon Dec 20, 2018
/milestone Serving 0.4
dgerd commentedon Jan 3, 2019
/assign vagababov
dgerd commentedon Jan 3, 2019
/unassign
mattmoor commentedon Jan 6, 2019
tl;dr I believe that this is related to some intermittent flakes that we see.
I believe @vagababov was able to reproduce this with sleeps in the Route controller, but here's an example from our continuous CI that I think may be related to this: https://gubernator.knative.dev/build/knative-prow/logs/ci-knative-serving-continuous/1081339923912462336
vagababov commentedon Jan 6, 2019
Implement verification for route readiness for the runLatest.
Implement verification for route readiness for the runLatest. (#2898)
Implement release mode checking for the service not yet being ready.
Release mode processing for the route not being ready. (#2948)