Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Event skipping and temp resource caching based on resourceVersion comparison#2987

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
csviri wants to merge21 commits intomain
base:main
Choose a base branch
Loading
fromcomparing-resource-version-dr

Conversation

@csviri
Copy link
Collaborator

@csviricsviri commentedOct 10, 2025
edited
Loading

At this point it is safe to say that we can compare resource versions, that is simplifies lots of our algortihms in JOSDK. This PR simplifies the dependent resource related event skipping and caching parts.

Will clearly describe this in release notes, along with the removed config properties.

csviriand others added15 commitsOctober 7, 2025 12:47
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
this was added to fabric8 client meanwhileSigned-off-by: Attila Mészáros <a_meszaros@apple.com>
)* feature: add AggregatedMetrics to support multiple Metrics implementationsSigned-off-by: David Sondermann <david.sondermann@hivemq.com>
)Co-authored-by: Chris Laprun <claprun@redhat.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Signed-off-by: Chris Laprun <claprun@redhat.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>Co-authored-by: Martin Stefanko <xstefank122@gmail.com>
closes:#2984Signed-off-by: Steve Hawkins <shawkins@redhat.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
@csviricsviri linked an issueOct 10, 2025 that may beclosed by this pull request
3 tasks
@csviricsviri changed the titleComparing resource version drEvent skipping and temp resource caching based on resourceVersion comparisonOct 10, 2025
>Long.parseLong(cachedResource.getMetadata().getResourceVersion());
}catch (NumberFormatExceptione) {
log.debug(
log.warn(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could this even be an error?

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

hmm, maybe even throw an exception at this point?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, the only problematic behavior could be poorly written mock servers that are providing invalid resourceVersions.

varres =temporaryResourceCache.getResourceFromCache(resourceID);
if (res.isEmpty()) {
returnisEventKnownFromAnnotation(newObject,oldObject);
returnfalse;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This handling doesn't seem directly related to resourceVersion comparability. It's to handle the case where the event comes in before the create / update puts the result in the cache.

Do you want to not worry about this case now, or is there some other locking or other logic not in this pr handling this case?

csviri reacted with eyes emoji
Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

yes, this alone is not enough, but we might simplify it anyways, and just react on event that our last updated resource event.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you explain this a bit more? I'm not sure at the point in time if we have enough information to know if the incoming event is from our reconciliation, or another actor.

Copy link
CollaboratorAuthor

@csviricsviriOct 10, 2025
edited
Loading

Choose a reason for hiding this comment

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

This is an outdated version but the current one:
this implementation assumes that we want to trigger reconiliation only on newer version of resources, that came after our update. So basically we store the latest updated version even if we don't cache the resource in the temporal cache in case resource versions are equal. So new resources can be compared with this one. Essentially dropping events for our update and the updates happened before.

Copy link
Collaborator

Choose a reason for hiding this comment

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

To clarify here's the timing sequence that the code is guarding against:

  • The reconciliation starts to do an update of a resource at v1.
  • Before the kubernetes client receives that result, the informer receives the event for the transition from v1 -> v2
  • That event is later than the lastest known event to the TemporaryResourceCache because it has yet to transition to v2, so canSkipEvent will return false.

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

ahh, yes, thank you pointing this out, might separate the PR and see if It is possible to handle that without the annotation.

Copy link
Collaborator

Choose a reason for hiding this comment

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

As far as I remember the only two approaches are locking or the annotation. Locking is more intrusive in other parts of the code, whereas the current annotation approach is prone to reconciliation loops if SSA change detection isn't perfect. We could probably come up with a way to reason over a stable hash, but that starts seeming expensive for this problem.

@csviricsviri marked this pull request as draftOctober 10, 2025 12:47
@openshift-ciopenshift-cibot added the do-not-merge/work-in-progressIndicates that a PR should not merge because it is a work in progress. labelOct 10, 2025
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
if (resource.isPresent()) {
returnisLaterResourceVersion(newResource,resource.get());
}
varlatestUpdated =latestUpdatedVersion.get(resourceID);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This strategy can also be used instead of tombstones. If we attempt to put something that already has been deleted, the delete event (and the latest in general) is guarenteed to have been based upon a resourceVersion that is newer.

csviri reacted with thumbs up emoji
Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

if you have the time pls add a pr for that.

Copy link
Collaborator

Choose a reason for hiding this comment

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

if you have the time pls add a pr for that.

Since that would be based upon the latest tracking, could you introduce / merge that (which will effectively shadow the latest tracked by the informer, but I'm not sure if you have anyone trying to use that directly) without the changes to the previous annotation? Or do you think you can complete that work in the near term?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually I think this can just be something like#2989

csviri reacted with eyes emoji
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
@openshift-merge-robotopenshift-merge-robot added the needs-rebaseIndicates a PR cannot be merged because it has merge conflicts with HEAD. labelOct 16, 2025
@openshift-merge-robot

PR needs rebase.

Instructions for interacting with me using PR comments are availablehere. If you have questions or suggestions related to my behavior, please file an issue against thekubernetes-sigs/prow repository.

@csviricsviriforce-pushed thenext branch 2 times, most recently from3075f11 to4972764CompareOctober 23, 2025 13:17
@csviricsviriforce-pushed thenext branch 2 times, most recently from09f7950 to26de0d2CompareNovember 25, 2025 12:15
Base automatically changed fromnext tomainNovember 25, 2025 14:39
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@shawkinsshawkinsshawkins left review comments

@metacosmmetacosmAwaiting requested review from metacosm

@xstefankxstefankAwaiting requested review from xstefank

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

do-not-merge/work-in-progressIndicates that a PR should not merge because it is a work in progress.needs-rebaseIndicates a PR cannot be merged because it has merge conflicts with HEAD.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Comparable Resource Versions in Kubernetes

7 participants

@csviri@openshift-merge-robot@shawkins@Donnerbart@xstefank@metacosm

[8]ページ先頭

©2009-2025 Movatter.jp