You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Create documentation to track conventional usage of Conditions #351
(Here is my $0.02 on the use of Conditions in Elafros, let's iterate on this and then get it written down so that we can be consistent in our use of Conditions across projects.)
It is my hope that with these guidelines we can make the Conditions we use more self-describing.
Type and Reason
Type is typically defined in terms of a Go-style enumeration (e.g. FooConditionType) and so the values this takes on may be reasoned about like values of an enum in a programmatic manner. Clients should guard against unrecognized condition types, in case of server/client version skew, however, we expect this set to grow slowly.
Reason is typically defined in terms of a string and so the values this takes on (while camelcase words) should be treated as opaque. Clients shouldn't programmatically act on their values, but bias towards using Reason as a terse explanation of the state for end-users (whereas Message is the long-form of this). The set of values these take on may change fairly rapidly.
Presence of Conditions
Status: False on a particular Type is taken to mean that the controller is actively driving this resource towards the state represented by Type.
Status: True on a particular Type is taken to mean that the resource is now observed to be in this state. It is possible for the resource to exit this state through observation, but from the perspective of the controller, this is the end state of a particular reconciliation (possibly unsuccessful if a failure Type).
Examples
With this world view the following combinations would not make sense for reasons inline:
conditions:
# We are not driving towards BuildComplete, since the build has failed.
- name: BuildCompletestatus: False
- name: BuildFailedstatus: True
conditions:
# Failure is not a condition the controller drives things towards.
- name: BuildFailedstatus: False
I wonder then if a condition like this (from the API draft) need to be teased out into separate conditions, as the current form relies on the Reason to convey the problem:
kind: Configuration
...
status:
latestReadyRevisionName: abc
latestCreatedRevisionName: bcd # Hasn't become became "Ready"
conditions:
- type: LatestRevisionReady
status: False
reason: ContainerMissing
message: "Unable to start because container is missing and build failed."
@cooperneil I don't think it's necessary bad to have a state: revision ready (false) and the reason why it's not ready. The reason could change. Otherwise we'll have another condition for every kind of failure? Or am I missing what you're proposing.
@cooperneil@evankanderson For the use case of a client interested in determining when the latest revision is either ready or never-going-to-become-ready, do we then need to qualify each of the enum states as either final or not?
It might be useful to have a separate condition for RolloutStable or something.
@vaikas-google, my question is in regards to the guidance:
Reason is typically defined in terms of a string and so the values this takes on (while camelcase words) should be treated as opaque. Clients shouldn't programatically act on their values
Question is, how does a client tool differentiate an error False state due to a Reason like ContainerMissing vs an expected False state (e.g. the container is still being built), if Reason is opaque but the condition has the form:
- type: LatestRevisionReady
status: False
reason: ContainerMissing
message: "Unable to start because container is missing and build failed."
Do we not need separate conditions for failure if client tools can only rely on Type and Status=True/False?
Agreed, if we follow the guidance that Reason is opaque for clients. I think it will be helpful to reformat/breakout all of the suggested conditions in the API draft to reflect terminal states, under the guidance in this issue (specifically the opaque Reason)
@sixolet -- does this suggestion work for you? I'm using you as a proxy for UI implementers, since you happen to be the first to actually try it for this API.
In #593 I want to update the conformance tests to assert against LatestRevisionReady, so I'm waiting to hear that either we do expect both to exist or for the code to be updated to only use LatestRevisionReady.
With additional discussion in #593 and with @sixolet, we're going to change this model to the following (changing #351 (comment)):
Each resource should define a small number of terminal success conditions as Types. This should bias towards fewer than 5 high-level error categories which are separate and meaningful for customers. For a Revision, these might be BuildSucceeded, ContainerFetched, and ContainerRunning.
Where it makes sense, resources should define a top-level "happy state" resource which indicates that the resource is set up correctly and ready to serve. This should be named Ready.
Terminal conditions should be set to Unknown while they are being reconciled towards success or failure. Terminal failure conditions (conditions with status False) should also supply additional details about the failure in the "Reason" and "Message" sections -- both of these should be considered to have unlimited cardinality, unlike Type.
@evankanderson what do you think is the best process for making sure these changes to the model are reflected in the conformance tests? ideally the work to update the model would change the conformance tests too
Activity
mattmoor commentedon Mar 13, 2018
(Here is my $0.02 on the use of Conditions in Elafros, let's iterate on this and then get it written down so that we can be consistent in our use of Conditions across projects.)
It is my hope that with these guidelines we can make the
Conditionswe use more self-describing.Type and Reason
Type is typically defined in terms of a Go-style enumeration (e.g.
FooConditionType) and so the values this takes on may be reasoned about like values of an enum in a programmatic manner. Clients should guard against unrecognized condition types, in case of server/client version skew, however, we expect this set to grow slowly.Reason is typically defined in terms of a
stringand so the values this takes on (while camelcase words) should be treated as opaque. Clients shouldn't programmatically act on their values, but bias towards using Reason as a terse explanation of the state for end-users (whereas Message is the long-form of this). The set of values these take on may change fairly rapidly.Presence of Conditions
Status: False on a particular Type is taken to mean that the controller is actively driving this resource towards the state represented by Type.
Status: True on a particular Type is taken to mean that the resource is now observed to be in this state. It is possible for the resource to exit this state through observation, but from the perspective of the controller, this is the end state of a particular reconciliation (possibly unsuccessful if a failure Type).
Examples
With this world view the following combinations would not make sense for reasons inline:
cooperneil commentedon Mar 13, 2018
@evankanderson
I wonder then if a condition like this (from the API draft) need to be teased out into separate conditions, as the current form relies on the Reason to convey the problem:
vaikas commentedon Mar 15, 2018
@cooperneil I don't think it's necessary bad to have a state: revision ready (false) and the reason why it's not ready. The reason could change. Otherwise we'll have another condition for every kind of failure? Or am I missing what you're proposing.
vaikas commentedon Mar 15, 2018
LGTM
evankanderson commentedon Mar 15, 2018
FWIW, I've started translating those docs into Markdown... I still need to move the pictures over and clean up a bit of formatting, but you can see the start here: https://github.com/evankanderson/elafros/tree/spec/docs/spec
In particular, we'd specified some of this in https://github.com/evankanderson/elafros/blob/spec/docs/spec/errors.md; I'll try to pry some time out tonight in addition to messing with Vault to get that into PR shape.
sixolet commentedon Mar 15, 2018
@cooperneil @evankanderson For the use case of a client interested in determining when the latest revision is either ready or never-going-to-become-ready, do we then need to qualify each of the enum states as either final or not?
It might be useful to have a separate condition for RolloutStable or something.
cooperneil commentedon Mar 15, 2018
@vaikas-google, my question is in regards to the guidance:
Question is, how does a client tool differentiate an error False state due to a Reason like ContainerMissing vs an expected False state (e.g. the container is still being built), if Reason is opaque but the condition has the form:
Do we not need separate conditions for failure if client tools can only rely on Type and Status=True/False?
mattmoor commentedon Mar 15, 2018
ContainerMissingseems like a terminal state, and I think should correspond to aConditionlikeFailedwithstatus: True.cooperneil commentedon Mar 15, 2018
Agreed, if we follow the guidance that Reason is opaque for clients. I think it will be helpful to reformat/breakout all of the suggested conditions in the API draft to reflect terminal states, under the guidance in this issue (specifically the opaque Reason)
7 remaining items
evankanderson commentedon Mar 29, 2018
@sixolet -- does this suggestion work for you? I'm using you as a proxy for UI implementers, since you happen to be the first to actually try it for this API.
sixolet commentedon Mar 29, 2018
@evankanderson Yes, as @cooperneil mentioned this is exactly what we discussed. I'm totally happy with it.
bobcatfish commentedon Apr 5, 2018
Quick note, discussed with @evankanderson, I wanted to point out that Configuration is currently using both "Ready" and "LatestRevisionReady" types (one replaces the other).
In #593 I want to update the conformance tests to assert against LatestRevisionReady, so I'm waiting to hear that either we do expect both to exist or for the code to be updated to only use LatestRevisionReady.
evankanderson commentedon Apr 24, 2018
With additional discussion in #593 and with @sixolet, we're going to change this model to the following (changing #351 (comment)):
BuildSucceeded,ContainerFetched, andContainerRunning.Ready.Unknownwhile they are being reconciled towards success or failure. Terminal failure conditions (conditions with statusFalse) should also supply additional details about the failure in the "Reason" and "Message" sections -- both of these should be considered to have unlimited cardinality, unlike Type.bobcatfish commentedon Apr 24, 2018
@evankanderson what do you think is the best process for making sure these changes to the model are reflected in the conformance tests? ideally the work to update the model would change the conformance tests too
evankanderson commentedon Apr 27, 2018
It turns out I had to update the conformance tests for prow to pass. 👍
Make all Conditions positive terminating conditions (#733)
mattmoor commentedon Apr 29, 2018
Given the churn in the discussion, I just wanted to echo Evan's comment and say that the source-of-truth is here not the discussion in this issue :)
evankanderson commentedon Apr 30, 2018
Yes, the spec is now up to date, and we should open new PRs if we want to change the behavior.
Update condition `type` in spec and do not assert against `reason` (#903