-
Notifications
You must be signed in to change notification settings - Fork 135
Handle null observedGeneration in condition Equal() #906
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
base: main
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Thank you for the clear change and tests — would you like me to add a note to the changelog or link this behavior to the related issue ( Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 error)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ulucinar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @bobh66,
Thanks for investigating this issue and proposing a fix. Please also see my comment here.
The .metadata.generation starts from 1, so observedGeneration being 0 effectively means it's not set. crossplane-runtime will always set the status conditions with a non-zero observedGeneration (because the resource's .metadata.generation cannot be 0). And if the provider cooperates (sets the observedGeneration, they should again always be non-zero). So only for a non-cooperating provider (a provider that does not set the observedGeneration on the status conditions it sets), the observedGeneration can be 0. And in that case, knowing the provider does not set observedGenerations, we can safely ignore them in comparisons.
Signed-off-by: Bob Haddleton <bob.haddleton@nokia.com>
939d0d7 to
940b552
Compare
Description of your changes
Modified the condition
Equial()method to check for unsetObservedGenerationfieldswhen comparing two conditions. If at least one of the
ObservedGenerations is 0 then the comparisonwill ignore the field since it will always be
False.This can happen when a provider does not set the
observedGenerationin aSyncedcondition duringObserve(), which causes it to appear to be different than theSyncedcondition that is set by the managed reconciler.Fixes #902
I have:
earthly +reviewableto ensure this PR is ready for review.- [ ] Linked a PR or a docs tracking issue to document this change.backport release-x.ylabels to auto-backport this PR.Need help with this checklist? See the cheat sheet.