Skip to content

Make all Conditions positive terminating conditions - #733

Merged
google-prow-robot merged 11 commits into
knative:masterfrom
evankanderson:wrong-error
Apr 27, 2018
Merged

google-prow-robot merged 11 commits into
knative:masterfrom
evankanderson:wrong-error

Conversation

@evankanderson

Copy link
Copy Markdown
Member

Fixes #351

Proposed Changes

  • Updates documentation to suggest that all Conditions should cover positive states that are being reconciled towards.
  • Updates existing Conditions to match documentation.

Release Note
```Updates all Conditions to simplify client-side success/failure determination. Reconciliation now attempts to drive Conditions to a True state for each type, with `False` state indicating either permanent failure (for Conditions other than `Ready') or inability to serve (for the `Ready` type).


This is a replacement/alternate proposal to #565 after discussing feedback with @mattmoor.

@google-prow-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: evankanderson

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-prow-robot google-prow-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 25, 2018
…so re-add the "IsFailed" condition, keying off of non-Ready conditions on the revision.

@mattmoor mattmoor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking really good, thanks for putting this together.

Comment thread docs/spec/errors.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think what we discussed offline made the above an even stronger statement.

Where it makes sense, resources should define a "Ready" condition that indicates
the status of reconciliation. Clients should not need to look at any other conditions
to determine the state of the resource.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at a minimum, the above has several typos:

  • "happy state" resource => "happy state" condition or type
  • "resourc"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about how this works for Build, "Ready" seems like an odd name.

I think the nuance is that services that should stay up, should use "Ready", but run-to-completion pods should probably bias towards a different name. WDYT?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I favor allowing two canonical names, one for "run to completion" resources like Build, one for persistently-going resources like Revision: "Succeeded" and "Ready"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naomi beat me to the punch on naming.

Comment thread docs/spec/errors.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably split this into two parts

  1. Talk about interpreting "Status: Foo"
  2. Talk about Reason/Message

For the former, I think you overly qualify "terminal". I think we should have something like:

  1. Each condition's status will be one of:

    • "Unknown" when the controller is actively working to achieve the condition Type's state.
    • "False" when the reconciliation has failed.
    • "True" when the reconcilitation has succeeded.

    Type names will be chosen such that these interpretations are clear, e.g.

    BuildSucceeded works because True = Success and False = Failure
    BuildCompleted does not because False could just mean "in-progress"
    

    For the special "Ready" condition, Unknown is the indicator of "in progress", and
    True/False indicate that the overall reconciliation is complete (in error, if False)

For the latter, I think we essentially want what you have, with a few tweaks:

  1. Conditions with a status of False will also supply details about the failure in the
    "Reason" and "Message" fields -- both of these should be considered to have
    unlimited cardinality, unlike Type. If a resource has a "Ready" type, it will surface
    the "Reason" and "Message" from the first failing sub Condition.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something else we discussed was allowing the elision of conditions with status True, if it's presence isn't useful / informative. I haven't seen that called out, but maybe I missed it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like eliding conditions with status True, because I want to be able to present green checkmarks in the client when each step of deploying a revision succeeds, even if the whole revision is not ready yet.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about eliding the other conditions when the revision becomes Ready?

Comment thread docs/spec/errors.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(meta-comment, we can open an issue to track this, since it's a bigger unrelated change)

I think we should restructure this doc to follow the resource hierarchy a bit more. I'd like a place where we can enumerate the Condition Types, and call out whether a resource has the "happy path" Type.

I'm commenting here mainly because Configuration won't have such a Type.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes -- I think this is something I'd like @labadav to help with the information architecture. This was originally a 40+ page doc, so I cut it on the existing sections, but those are probably not correct, and we should probably have some sort of table of contents and forward/back linkages.

Comment thread docs/spec/errors.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the rollout here is vestigial.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment thread docs/spec/errors.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand why we'd clear latestReadyRevisionName if the "most recent .... Revision is deleted", assuming it is not also the "most recently ready Revision". Can we update this wording?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated; I'd combined two cases here.

Comment thread pkg/apis/ela/v1alpha1/revision_types.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect that clients would just need to look at Ready = False, but if we're using this to populate Ready's status, then perhaps we should key off of any condition with a status of False.

I guess this is a long way of saying: let's just remove the "Ready" exclusion?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"All success conditions"

Also as noted above it should be an error to have Ready=True while some other success condition is False. The converse is not implied -- Ready can be False even if all other success conditions are True, so it certainly shouldn't be excluded from IsFailed

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're using "IsFailed" to determine whether we need to do further reconciliation of the Revision. For the case where inactive revisions are marked Ready = False (Reason = Inactive), I didn't want "IsFailed" to return true.

Comment thread pkg/controller/revision/revision.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This case should return true, true

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol, how did I miss that?

Do we have an "always fails" build? I supposed I can use one of the samples and point at a non-existent branch.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the build repo two of the conformance test builds intentionally fail. One by simply running the false command. The other is a test that if the process panics that the messages end up in our logs.

Comment thread pkg/controller/revision/revision.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I have an idea :)

Seems like given the conventions we have outlined that we could automatically manage the "Ready" Condition via calls to SetCondition. This would make it much harder to run afoul of our guidelines, WDYT?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to leave out cases where we are not Ready but all else is green?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to get this PR in and then refactor, but that seems likely.

Do you want me to add a TODO?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @mattmoor is suggesting that SetCondition() with a status of false could also populate the Ready condition automatically.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: use constant

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this seems to be fairly widespread...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the goal in the test is to avoid re-using the constants from the other file, and instead show things closer to the user PoV.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm not mistaken this is supposed to be ContainerDeadlineExceeded?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh look, we implemented something different than the spec. Thanks!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, it appears that we pass through ExceededReadinessChecks from the underlying Deployment. (See revision.go, line 458)

@sixolet sixolet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the biggest change I have is to talk about "success conditions", where the only "terminal conditions" are Ready (or also maybe Succeeded)

Comment thread docs/spec/errors.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each resource should define a small number of success condition Types. I like calling these "success conditions" rather than "terminal conditions", because that's more descriptive of what they are. Ready/Succeeded are the only ones that really feel "terminal" to me.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I described these as "success conditions" and "progress categories" -- thanks for calling this out.

Comment thread docs/spec/errors.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rm "error"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, directed this towards success instead of failure. This is what happens when I copy text quickly from one PR to another while carrying on a conversation.

Comment thread docs/spec/errors.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/resource/condition type/

Comment thread docs/spec/errors.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I favor allowing two canonical names, one for "run to completion" resources like Build, one for persistently-going resources like Revision: "Succeeded" and "Ready"

Comment thread docs/spec/errors.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Terminal/Success/

Comment thread pkg/apis/ela/v1alpha1/revision_types.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"All success conditions"

Also as noted above it should be an error to have Ready=True while some other success condition is False. The converse is not implied -- Ready can be False even if all other success conditions are True, so it certainly shouldn't be excluded from IsFailed

Comment thread docs/spec/errors.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like eliding conditions with status True, because I want to be able to present green checkmarks in the client when each step of deploying a revision succeeds, even if the whole revision is not ready yet.

Comment thread docs/spec/errors.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type: Succeeded
status: False

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We haven't tackled build.elafros.dev yet. (Since that's in a separate repo.)

I'll add it to the TODO list.

Comment thread docs/spec/errors.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the lack of Ready-ness is caused by a different success condition being False, the reason and message of Ready SHOULD match the condition that caused the failure.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed on line 58 in the general guidance.

Comment thread pkg/controller/revision/revision.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to leave out cases where we are not Ready but all else is green?

@evankanderson evankanderson left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the comments, I think I've addressed all of them.

I want to add one more test for my "Build failed, progress the world" bug, but PTAL.

Comment thread docs/spec/errors.md Outdated

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM.

Comment thread docs/spec/errors.md Outdated

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naomi beat me to the punch on naming.

Comment thread docs/spec/errors.md Outdated

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes -- I think this is something I'd like @labadav to help with the information architecture. This was originally a 40+ page doc, so I cut it on the existing sections, but those are probably not correct, and we should probably have some sort of table of contents and forward/back linkages.

Comment thread docs/spec/errors.md Outdated

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated; I'd combined two cases here.

Comment thread docs/spec/errors.md Outdated

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'd previously copied the name from Deployment (which has other moving parts involved), but I'm happy to change it back.

Comment thread docs/spec/errors.md Outdated

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about eliding the other conditions when the revision becomes Ready?

Comment thread docs/spec/errors.md Outdated

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, I think.

Comment thread docs/spec/errors.md Outdated

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We haven't tackled build.elafros.dev yet. (Since that's in a separate repo.)

I'll add it to the TODO list.

Comment thread docs/spec/errors.md Outdated

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed on line 58 in the general guidance.

Comment thread pkg/controller/revision/revision.go Outdated

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @mattmoor is suggesting that SetCondition() with a status of false could also populate the Ready condition automatically.

Comment thread docs/spec/errors.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I am ok with this. It's still a little odd: a very quick deploy is going to skip showing intermediate steps, whereas a slower one will show intermediate steps. That inconsistent behavior is in line with a reasonable user experience, though -- it's only longer-running operations where you care about watching the sub-steps.

PS there's a spelling error on line 51

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think our expectation is that higher-level UX will be more common than kubectl describe, so I'm open to leaving in transition conditions (even once complete) if we think it will meaningfully improve things.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think i twill.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this guidance (which I hadn't implemented yet, anyway).

Comment thread docs/spec/errors.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think our expectation is that higher-level UX will be more common than kubectl describe, so I'm open to leaving in transition conditions (even once complete) if we think it will meaningfully improve things.

Comment thread docs/spec/errors.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Condition (drop plural)

Comment thread docs/spec/errors.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tl;dr I think LatestRevisionReady may be a misnomer.

Suppose: LastestCreatedRevisionName == LatestReadyRevisionName

Question: If this revision were to reach Ready = False (vs. being deleted) I assume (based on the name) that we would also make the configuration's LatestRevisionReady condition False, right?

However, what if the reason for this is that the named revision is put into ServingState = Reserve, which I believe should set the revision's Ready condition to False, and cascade as you outline.

I'll propose LatestRevisionAvailable as an alternative, since it may not be Ready, but it is available to make Reserve => Active and become Ready. WDYT?

cc @grantr @josephburnett

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we defer this to another issue?

I think there's probably an interesting state machine -- my short answer would be that LatestReadyRevisionName should "latch" when a Revision becomes ready, so that pointing a Route at the Configuration will activate the Revision, even if it's Ready = False at the moment.

Note that this is covering the Revision being deleted, not marked as not Ready (so the cascade I outlined wouldn't apply). On the other hand, I'm happy to change the name if we find a better name.

Comment thread docs/spec/errors.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reason should be considered a terminal condition

nit: reasons aren't conditions :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixt.

Comment thread docs/spec/errors.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: period placement

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread pkg/controller/revision/revision.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the build repo two of the conformance test builds intentionally fail. One by simply running the false command. The other is a test that if the process panics that the messages end up in our logs.

@mattmoor

Copy link
Copy Markdown
Contributor

cc @imjasonh since we should adopt these conventions for Build as well.

Comment thread docs/spec/errors.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"happy stnate" :)

@evankanderson

Copy link
Copy Markdown
Member Author

Updated, including test.

@evankanderson

Copy link
Copy Markdown
Member Author

/retest

1 similar comment
@evankanderson

Copy link
Copy Markdown
Member Author

/retest

@bobcatfish

bobcatfish commented Apr 27, 2018 •

Copy link
Copy Markdown
Contributor

<removed> I hadn't updated my cluster, this was misinformation.

@bobcatfish

Copy link
Copy Markdown
Contributor

ahem now that I've actually updated my cluster, @evankanderson it looks like the test failure you're seeing now is b/c the conformance tests need an update:

STEP: The Revision will be updated when it is ready to serve traffic

• Failure [1.465 seconds]
Route
/usr/local/google/home/christiewilson/Code/go/src/github.com/elafros/elafros/test/conformance/route_test.go:156
  Deploying an app with a pre-built container
  /usr/local/google/home/christiewilson/Code/go/src/github.com/elafros/elafros/test/conformance/route_test.go:193
    Creates a route, serves traffic to it, and serves traffic to subsequent revisions [It]
    /usr/local/google/home/christiewilson/Code/go/src/github.com/elafros/elafros/test/conformance/route_test.go:194

    Expected
        <v1.ConditionStatus>: Unknown
    to equal
        <v1.ConditionStatus>: True

    /usr/local/google/home/christiewilson/Code/go/src/github.com/elafros/elafros/test/conformance/route_test.go:115

Docs on how to run the conformance tests

@evankanderson

Copy link
Copy Markdown
Member Author

Hey look, that was handy! I found out that my dev machine was slightly broken, and I got to learn about how the conformance tests work.

/retest

@evankanderson

Copy link
Copy Markdown
Member Author

/assign @bobcatfish

(Also still need an /lgtm if this does LG.) Once this is merged, I'll file a follow-on issue for the LatestReadyRevisionName conflict with activation/deactivation.

@mattmoor

Copy link
Copy Markdown
Contributor

/lgtm

@google-prow-robot google-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 27, 2018
@google-prow-robot
google-prow-robot merged commit 646fe6b into knative:master Apr 27, 2018
@evankanderson
evankanderson deleted the wrong-error branch April 30, 2018 16:59
nak3 added a commit to nak3/serving that referenced this pull request May 3, 2021
knative/operator@5636e31 includes autoscaler HA support
so we can run e2e test against test/ha/autoscaler_test.go.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants