Read Object from k8s API directly instead of cache to avoid getting outdated object #1017
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
issue: https://github.ibm.com/IBMPrivateCloud/roadmap/issues/62214
Context
Once Route
keycloak
is created by ODLM, and ODLM would revokeClient.Get()
request to read thehost
from Route object. However, the Route object is instantly reconciled by openshift controller after it is created. As a result, Route Object stored in the ODLM's cache is outdated, and ODLM is not able to update it with errorthe object has been modified; please apply your changes to the latest version and try again
Solution
Use
Reader.Get()
to always get the object from the cluster