Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Design for customer facing resource states #1614

Merged
merged 4 commits into from
Jul 12, 2021

Conversation

matthchr
Copy link
Member

@matthchr matthchr commented Jul 1, 2021

Closes #1448

What this PR does / why we need it:
A design for how to expose the state of a resource to customers in ASO v2

@matthchr
Copy link
Member Author

matthchr commented Jul 1, 2021

I filed #1615 for actually implementing this. We can decide if we want to do it in alpha-0 or some other alpha release.

@matthchr
Copy link
Member Author

matthchr commented Jul 2, 2021

Based on comments during live review, will update to be more like CAPI's.
Also change the "Deploying" to "Reconciling"

@theunrepentantgeek theunrepentantgeek added this to the codegen-alpha-1 milestone Jul 5, 2021
@codecov-commenter
Copy link

codecov-commenter commented Jul 5, 2021

Codecov Report

Merging #1614 (eaf4c27) into master (744f90b) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1614   +/-   ##
=======================================
  Coverage   66.63%   66.63%           
=======================================
  Files         204      204           
  Lines       14760    14760           
=======================================
  Hits         9835     9835           
  Misses       4169     4169           
  Partials      756      756           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 744f90b...eaf4c27. Read the comment docs.

@matthchr matthchr force-pushed the design/resource-states branch 2 times, most recently from 09c2937 to 04c97cc Compare July 6, 2021 21:20
@matthchr
Copy link
Member Author

matthchr commented Jul 6, 2021

Saw some formatting issues -- will fix those

Copy link
Member

@devigned devigned left a comment

Choose a reason for hiding this comment

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

I left a little grammar nit, but otherwise lgtm.

The uniformity of providing a Ready condition feels like a good choice. It simplifies the Azure reconciliation cycle and is easily consumed by tooling. I also like the use of reason and severity to provide guidance on progress as well as failure states (still progressing, user intervention needed, and terminal).

I don't have a strong opinion about kstatus. It seems like the tooling would pick up on Ready as effectively as kstatus.

docs/design/resource-states.md Outdated Show resolved Hide resolved

## Open questions
1. There are some small differences between this proposal and what CAPI is doing
* CAPI says `Reason` is optional, but we're making it required.

Choose a reason for hiding this comment

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

I believe the reason Reason (😄 ) is optional is that it should only be set when the condition is False. There is no Reason on True Conditions

Choose a reason for hiding this comment

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

I guess the official recommendations do say it should be required though

reason is required and must not be empty. The actor setting the value should always describe why the condition is the way it is, even if that value is "unknown unknowns". No other actor has the information to make a better choice.

need to go back and check why that's not the case in CAPI

Copy link
Member Author

Choose a reason for hiding this comment

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

Given that there are infinitely many failure cases and really only one success case, it feels "ok" to give a (somewhat useless) Reason like Success for the one success case, as it then saves everybody from then having think about an empty reason.

With that said the guidance isn't really crystal clear as Reason is clearly optional here.

Choose a reason for hiding this comment

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

Got a better answer on the CAPI slack: https://kubernetes.slack.com/archives/C8TSNPY4T/p1625615995097600

In case you can't open the link:

cecile Yesterday at 4:59 PM
Does anyone know/remember why CAPI conditions have Reason as optional? The KEP from apimachinery says it should be required:
reason is required and must not be empty. The actor setting the value should always describe why the condition is the way it is, even if that value is “unknown unknowns”. No other actor has the information to make a better choice.

fabrizio.pandini 6 hours ago
Umhh, this comment does not match what the API types are defining few lines above in the doc
// The reason for the condition’s last transition in CamelCase.
// The specific API may choose whether or not this field is considered a guaranteed API.
// This field may not be empty.

fabrizio.pandini 6 hours ago
I personally don’t think that always adding a reason to a condition makes sense,
thing e.g,. when a condition signals everything is ok, like e.g. Machine Ready true (adding a reason in this case will be just redundant)
Instead, I think that adding a reason in case the condition are signalling a problem makes much more sense

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not entirely sure I follow this answer. It seems to say:

  1. Actually each specific API can choose if Reason is required or not.
  2. Fabrizio (and a few others who thumbs up-ed his answer) don't see much reason to include Reason when the condition signals OK.

I agree with point 2... but it's a really minor quibble. I can't imagine people getting confused by a reason that was included in the success case, and always including reason has the advantage that you can make a nice simple statement about reason: "It's always set". More importantly than that though, it matches the KEP. The other places where the CAPI diverged from the KEP were explicitly called out.

@Porges, @theunrepentantgeek, @babbageclunk - you have thoughts on this topic?

Copy link
Member

Choose a reason for hiding this comment

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

A reason like ReconciliationComplete would make it clear that the reason (heh) Ready is now true is that we've done all our stuff. Removes ambiguity about how we got here.

Copy link
Member

Choose a reason for hiding this comment

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

I can see that Reason is redundant when Ready is true (it's like that Tolstoy quote about happy families), but I think the simplicity of having it always present is worth that wrinkle.

@matthchr
Copy link
Member Author

matthchr commented Jul 7, 2021

Note to self to add another open question: LastTransitionTime in the spec is documented as: "the last time the condition transitioned from one status to another." Status is a particular field, which can oftentimes not change even while the underlying Reason, Severity, or Message does change.

Do we want to define LastTransitionTime as the last time anything changed, or just the last time the Status field changed?

Copy link
Member

@theunrepentantgeek theunrepentantgeek left a comment

Choose a reason for hiding this comment

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

Looks really good. A bunch of comments, nothing particularly important.

docs/design/resource-states.md Show resolved Hide resolved
docs/design/resource-states.md Outdated Show resolved Hide resolved
docs/design/resource-states.md Outdated Show resolved Hide resolved
docs/design/resource-states.md Show resolved Hide resolved
docs/design/resource-states.md Show resolved Hide resolved
docs/design/resource-states.md Outdated Show resolved Hide resolved
docs/design/resource-states.md Outdated Show resolved Hide resolved
docs/design/resource-states.md Show resolved Hide resolved

## Open questions
1. There are some small differences between this proposal and what CAPI is doing
* CAPI says `Reason` is optional, but we're making it required.
Copy link
Member

Choose a reason for hiding this comment

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

A reason like ReconciliationComplete would make it clear that the reason (heh) Ready is now true is that we've done all our stuff. Removes ambiguity about how we got here.

docs/design/resource-states.md Outdated Show resolved Hide resolved
Copy link
Member

@theunrepentantgeek theunrepentantgeek left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks for the updates.

docs/design/resource-states.md Show resolved Hide resolved
@CecileRobertMichon
Copy link

Do we want to define LastTransitionTime as the last time anything changed, or just the last time the Status field changed?

FWIW, this is how CAPI answers that question:

// NOTE: If a condition already exists, the LastTransitionTime is updated only if a change is detected
// in any of the following fields: Status, Reason, Severity and Message.

@matthchr
Copy link
Member Author

Thanks @CecileRobertMichon - I've also adopted that approach.

@matthchr matthchr merged commit ad0d3e6 into Azure:master Jul 12, 2021
@matthchr matthchr deleted the design/resource-states branch July 12, 2021 22:41
@matthchr matthchr mentioned this pull request Jul 30, 2021
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Design customer visible states and their meanings
7 participants