Draft: Add UpToDate condition for managed resources#942
Open
bobh66 wants to merge 1 commit intocrossplane:mainfrom
Open
Draft: Add UpToDate condition for managed resources#942bobh66 wants to merge 1 commit intocrossplane:mainfrom
bobh66 wants to merge 1 commit intocrossplane:mainfrom
Conversation
jcogilvie
reviewed
Mar 16, 2026
apis/common/condition.go
Outdated
| // Equal returns true if the condition is identical to the supplied condition, | ||
| // ignoring the LastTransitionTime. If one or both conditions have not | ||
| // provided the ObservedGeneration it is not considered in the comparison. | ||
| // ignoring the LastTransitionTime. |
Contributor
Author
There was a problem hiding this comment.
Oops - left over from previous changes. Must not have cleaned up properly. I'll remove.
| record.Event(managed, event.Warning(reasonCannotDisconnect, err)) | ||
| } | ||
|
|
||
| if external != nil { |
| MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error { | ||
| want := newLegacyManaged(42) | ||
| want.SetConditions(xpv1.ReconcileSuccess().WithObservedGeneration(42)) | ||
| want.SetConditions(xpv1.ReconcileSuccess().WithObservedGeneration(42), xpv1.ObserveMatch().WithObservedGeneration(42)) |
There was a problem hiding this comment.
It doesn't look like we ever assert on the diff message in any of these tests -- could/should we?
Contributor
Author
There was a problem hiding this comment.
Probably should for the three cases where it can happen. I'll have to look into how we can inject specific diffs, since it isn't finding any now.
Signed-off-by: Bob Haddleton <bob.haddleton@nokia.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of your changes
Adds a new UpToDate condition (name is subject to better suggestions) that exposes the
ResourceUpToDatestatus from theObserve()call. This allows users to know whether the ManagedResource desired state matches the external resource, and whether an update has been requested, failed, or restricted by management policies.There are five basic (non-error condition) scenarios:
managementPolicies, the condition is FalseThe three False condition scenarios will include the contents of the
observation.Diffif it is available.This is important when importing existing resources to be able to be sure that Crossplane will not make any enexpected changes to the external resource.
Fixes #939
I have:
./nix.sh flake checkto ensure this PR is ready for review.- [ ] Linked a PR or a docs tracking issue to document this change.- [ ] Addedbackport release-x.ylabels to auto-backport this PR.Need help with this checklist? See the cheat sheet.