Skip to content

IsObjectFound function should not bury unexpected errors #1728

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jgwest
Copy link
Member

@jgwest jgwest commented May 3, 2025

What type of PR is this?
/kind bug

What does this PR do / why we need it:

Currently, the IsObjectFound utility function is used to check whether a particular object exists on the cluster. It is used across the codebase, and with many different types of objects.

Unfortunately, IsObjectFound is making an incorrect assumption: this function assumes that ANY error that occurs (besides is not found) should be treated the same as the object not existing.

For example:

Cause Return value
A) No error on Get object call IsObjectFound returns true
B) Not found error on Get object call IsObjectFound returns false
C) Any other error occurs on Get object call (network error, permission error, TLS error, etc) IsObjectFound returns false

Notice that B and C, despite very different causes, return the same false of false.

This PR updates the function signature of IsObjectFound to return (rather than burying) the error, and updates all locations in the code where it is called.

@jgwest jgwest force-pushed the fix-is-object-found-jan-2024 branch 3 times, most recently from be6282a to 40cc448 Compare May 8, 2025 03:50
@jgwest jgwest force-pushed the fix-is-object-found-jan-2024 branch from 40cc448 to 93e96b8 Compare May 8, 2025 04:06
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.

1 participant