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

Expand MR Status Condition Type details #752

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

plumbis
Copy link
Collaborator

@plumbis plumbis commented Apr 12, 2024

This PR resolves #750, adding details on the Condition types.

I also added hover tags for all status reasons.

Signed-off-by: Pete Lumbis <pete@upbound.io>
Copy link

netlify bot commented Apr 12, 2024

Deploy Preview for crossplane ready!

Name Link
🔨 Latest commit f91bcf3
🔍 Latest deploy log https://app.netlify.com/sites/crossplane/deploys/661ec2a44cf1760008745c93
😎 Deploy Preview https://deploy-preview-752--crossplane.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 89 (🔴 down 2 from production)
Accessibility: 88 (🔴 down 3 from production)
Best Practices: 83 (no change from production)
SEO: 93 (no change from production)
PWA: 70 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Member

@negz negz left a comment

Choose a reason for hiding this comment

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

Thanks @plumbis!

My comments might be too much detail for the docs, so take from them whatever you think is appropriate.

Another note of potential interest: readiness is cumulative but synced-ness is not.

A claim only becomes ready when its XR and its entire tree of composed resources (including nested XRs and their composed resources) become ready.

On the other hand, a claim becomes synced as soon as it applies it desired state to the XR, even if that state is nonsensical and results in a broken XR. (The claim controller still did what it was asked to without hitting an error.) Ditto with XRs and MRs - as long as they successfully do what you told them they'll be synced.

In general (across claims, XRs, and MRs) you can think of "synced" as meaning "Crossplane was able to do what you told it to do". "Ready" means "what you told Crossplane to do resulted in (apparently) working infrastructure".

content/master/concepts/managed-resources.md Show resolved Hide resolved
content/master/concepts/managed-resources.md Outdated Show resolved Hide resolved
Signed-off-by: Pete Lumbis <pete@upbound.io>
@plumbis
Copy link
Collaborator Author

plumbis commented Apr 16, 2024

Thanks @negz ! I updated those two sections, let me know if you're good with this or have any other feedback. When we're good I'll copy this to the v1.15 folder as well.

content/master/concepts/managed-resources.md Show resolved Hide resolved
Comment on lines +910 to +913
The condition `Type: Synced` and `Status: True` means Crossplane successfully
communicated with the Provider on the status of the manged resource and synced
the managed resource's desired state with the observed state of the external
resource.
Copy link
Member

Choose a reason for hiding this comment

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

I'd suggest leaving out "Crossplane communicated with the provider". I think it's misleading.

There's really no communication between Crossplane and the provider here, everything is done entirely by the provider.

You could either just talk about what the provider did, without mentioning Crossplane, or simplify and talk about what Crossplane did. I'd prefer the former, but the latter also makes sense if I think of "Crossplane" as a whole system, rather than a specific component.

Edit: Or by "Provider" do you mean "external system"? The capital P in Provider makes me think you're talking about the component of Crossplane, not the external system,

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, I meant the Provider component. How's this:

Condition Type: Synced indicates the Provider has checked the status of the
managed resource with the external service.

(I don't love 'external service` but I don't want to say Provider twice)

Comment on lines +907 to +908
Condition `Type: Synced` indicates Crossplane has checked the status of the managed
resource with the Provider.
Copy link
Member

Choose a reason for hiding this comment

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

Is there a verb other than "checked" that could work here?

Checked reads as if "syncing" a resource is a read-only operation, but it isn't.

I like "update or determine" below if that's not too unwieldy here. So "Crossplane has updated and determined the status of the managed resource".

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

How about "validated the status of the managed resource..."?

I'm trying to break the Condition and Status into two parts, where the Condition is "we tried to inspect at the MR" and the status is "inspection worked and now update if needed". Because of that I want to avoid "updated" in the first paragraph.

Copy link
Member

Choose a reason for hiding this comment

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

I'm trying to break the Condition and Status into two parts, where the Condition is "we tried to inspect at the MR" and the status is "inspection worked and now update if needed".

Breaking it into two parts doesn't make sense to me. The status condition represents the entire reconcile operation, not only the inspection of the MR.

Maybe writing out what happens in pseudocode would help explain this better:

def sync_resource():
  desired = read_desired_state()
  actual = read_actual_state()
  if actual != desired:
    update_actual_state(desired)

def main():
  while True:
    try:
      sync_resource()
    except SyncException:
     set_condition_synced_false()
    else:
     set_condition_synced_true()
    sleep(60)

Most reconcile loops boil down to read desired state, read actual state, update actual state to match desired state. If all of that works we set Synced: true. If any of that fails we set Synced: false.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Got it.

When does a resource move from Ready/True to Synced/True? On the first reconcile after it's ready?

Copy link
Member

Choose a reason for hiding this comment

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

When does a resource move from Ready/True to Synced/True?

The two condition types (Synced and Ready) are independent of each other, so I wouldn't think a resource moving from one to the other.

That said, Synced: True is usually going to happen first, because for Synced to be True the controller just needs to get through one reconcile loop without hitting an error.

Let's say it's the very first reconcile of an MR, and the code managed to observe the external resource, notice it doesn't exist, and create it. Synced would be True because the controller just "synced" the desired state. In this case, by creating the external resource.

Often Ready: True would happen a bit later, because many MR controllers observe the external resource to see whether it appears to be ready (according to the API). So at that point the MR would be Synced: True and Ready: True.

Copy link
Member

Choose a reason for hiding this comment

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

Expanding on the pseudocode to include the ready condition:

def sync_resource():
  desired = read_desired_state()
  actual = read_actual_state()
  if actual != desired:
    update_actual_state(desired)
  return actual

def main():
  while True:
    try:
      actual_state = sync_resource()
      if is_ready(actual_state):
        set_condition_ready_true()
      else:
        set_condition_ready_false()
    except SyncException:
     set_condition_synced_false()
    else:
     set_condition_synced_true()
    sleep(60)

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.

Provide details about standard conditions used by Crossplane
2 participants