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

improve: logging if no primary found for resource id #2036

Merged
merged 2 commits into from
Aug 28, 2023
Merged

Conversation

csviri
Copy link
Collaborator

@csviri csviri commented Aug 28, 2023

No description provided.

@csviri csviri self-assigned this Aug 28, 2023
@openshift-ci openshift-ci bot requested review from adam-sandor and andreaTP August 28, 2023 07:39
@csviri csviri requested review from metacosm and removed request for andreaTP and adam-sandor August 28, 2023 07:39
@@ -146,7 +146,7 @@ private void submitReconciliationExecution(ResourceState state) {
controllerUnderExecution,
maybeLatest.isPresent());
if (maybeLatest.isEmpty()) {
log.debug("no custom resource found in cache for resource id: {}", resourceID);
log.debug("no primary resource found in cache with resource id: {}", resourceID);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Better but still doesn't address the fact that we might get into that state because we're triggering event processing even though we don't expect a resource to even exist in the cache (like if a user sends events for resources that are not tracked by the Reconciler), i.e. the cache is an implementation detail that might be confusing, i.e. a user might then think: ok, it's not in cache, then fetch it from the server instead!
That said, it's indeed a debug level log so maybe it doesn't matter all that much.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we don't expect a resource to even exist in the cache

Yeah, but this is not always the case, if the controller informer is lagging (reconnect issues), the resource might be actually expected, just not yet there.

it's not in cache, then fetch it from the server instead!

this is for primary, not sure if there is a place to fetch it; since the reconciler never triggered.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

But can add some comments there above the log message, to explain why this can happen.

@csviri csviri merged commit 28aa164 into main Aug 28, 2023
@csviri csviri deleted the text-improve branch August 28, 2023 15:00
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.

2 participants