Skip to content

Conversation

@shawkins
Copy link
Collaborator

@shawkins shawkins commented Oct 21, 2025

Replaces: #2989 to target v5.3

Adds per informer configuration and uses the configuration for the primary resource.

Probably superceded by : #3015 - at the very least some changes from there are needed here.

Signed-off-by: Steve Hawkins <[email protected]>
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 21, 2025
Copy link
Collaborator

@csviri csviri left a comment

Choose a reason for hiding this comment

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

Added some comments to fill in some details, refine naming.

But otherwise this looks awesome! thank you!

return this;
}

public Builder<R> parseResourceVersionsForEventFilteringAndCaching(boolean parse) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

comparableResourceVersions we should probably have this also as withComparableResourceVersions(boolean) that is a more generic name.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I did this to be consistent with the other configuration for now. I can use a different name to start with here, or we can use a follow-up issue on how to approach the renaming in general.

private PrimaryToSecondaryMapper<?> primaryToSecondaryMapper;
private SecondaryToPrimaryMapper<R> secondaryToPrimaryMapper;
private KubernetesClient kubernetesClient;
private boolean comparableResourceVersions = true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should add this also to @KubernetesDependent annotation.

log.debug("Resource found in cache: {} for id: {}", res.isPresent(), resourceID);
return res;
}
log.debug(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would it make sense also to log if parseResourceVersions is true/false? But that might be trivial to see.


public Optional<String> getLastSyncResourceVersion(Optional<String> namespace) {
return getSource(namespace.orElse(WATCH_ALL_NAMESPACES))
.map(source -> source.getLastSyncResourceVersion());
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: can be replaced by methode reference

Copy link
Collaborator Author

@shawkins shawkins Oct 23, 2025

Choose a reason for hiding this comment

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

Sorry, this can be removed - see #3015

.getResourceVersion()
.equals(previousResourceVersion))
|| isLaterResourceVersion(resourceId, newResource, cachedResource))) {
// first check against the source in general - this also prevents resurrecting resources when
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you pls expand the comment, and explain more in details (maybe sequence of events) how this prevents resurrection ?

@shawkins
Copy link
Collaborator Author

@csviri do you want me to refine this pr, or just move onto ##3015

@csviri
Copy link
Collaborator

csviri commented Oct 23, 2025

@csviri do you want me to refine this pr, or just move onto ##3015

Will review that, probably we can move on with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants