Skip to content

Create documentation to track conventional usage of Conditions #351

Closed

Description

@mattmoor

I think it would be good to formalize our conventions around the use of status (building on this).

@cooperneil and I were discussing this and want to make sure we build this consistently.

I'll post a blurb with my mental model next, but want to open this to track.

Activity

  1. added
    kind/doc
    area/API
    on Mar 13, 2018
  2. mattmoor commented on Mar 13, 2018

    @mattmoor
    ContributorAuthor

    (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: BuildComplete
      status: False
    - name: BuildFailed
      status: True
    conditions:
    # Failure is not a condition the controller drives things towards.
    - name: BuildFailed
      status: False
  3. cooperneil commented on Mar 13, 2018

    @cooperneil

    @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:

    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."
    
  4. vaikas commented on Mar 15, 2018

    @vaikas
    Contributor

    @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.

  5. vaikas commented on Mar 15, 2018

    @vaikas
    Contributor

    LGTM

  6. evankanderson commented on Mar 15, 2018

    @evankanderson
    Member

    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.

  7. sixolet commented on Mar 15, 2018

    @sixolet
    Contributor

    @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.

  8. cooperneil commented on Mar 15, 2018

    @cooperneil

    @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?

  9. mattmoor commented on Mar 15, 2018

    @mattmoor
    ContributorAuthor

    ContainerMissing seems like a terminal state, and I think should correspond to a Condition like Failed with status: True.

  10. cooperneil commented on Mar 15, 2018

    @cooperneil

    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)

  11. 7 remaining items

  12. evankanderson commented on Mar 29, 2018

    @evankanderson
    Member

    @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.

  13. sixolet commented on Mar 29, 2018

    @sixolet
    Contributor

    @evankanderson Yes, as @cooperneil mentioned this is exactly what we discussed. I'm totally happy with it.

  14. removed their assignment
    on Apr 3, 2018
  15. bobcatfish commented on Apr 5, 2018

    @bobcatfish
    Contributor

    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.

  16. added this to the milestone on Apr 11, 2018
  17. evankanderson commented on Apr 24, 2018

    @evankanderson
    Member

    With additional discussion in #593 and with @sixolet, we're going to change this model to the following (changing #351 (comment)):

    1. 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.
    2. 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.
    3. 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.
  18. bobcatfish commented on Apr 24, 2018

    @bobcatfish
    Contributor

    @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

  19. evankanderson commented on Apr 27, 2018

    @evankanderson
    Member

    It turns out I had to update the conformance tests for prow to pass. 👍

  20. mattmoor commented on Apr 29, 2018

    @mattmoor
    ContributorAuthor

    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 :)

  21. evankanderson commented on Apr 30, 2018

    @evankanderson
    Member

    Yes, the spec is now up to date, and we should open new PRs if we want to change the behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/APIkind/doc

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions