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

Read Object from k8s API directly instead of cache to avoid getting outdated object #1017

Merged
merged 1 commit into from
Feb 22, 2024

Conversation

Daniel-Fan
Copy link
Contributor

@Daniel-Fan Daniel-Fan commented Feb 21, 2024

issue: https://github.ibm.com/IBMPrivateCloud/roadmap/issues/62214

Context

Once Route keycloak is created by ODLM, and ODLM would revoke Client.Get() request to read the host 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 error the object has been modified; please apply your changes to the latest version and try again

E0221 16:32:21.723501 1 manager.go:587] Failed to get value reference from Object 4-5-test/keycloak with path .spec.host: failed to update Route 4-5-test/keycloak: Operation cannot be fulfilled on routes.route.openshift.io "keycloak": the object has been modified; please apply your changes to the latest version and try again
E0221 16:32:21.723558 1 manager.go:479] Failed to get value reference from Object for OperandConfig 4-5-test/common-service on field hostname: failed to update Route 4-5-test/keycloak: Operation cannot be fulfilled on routes.route.openshift.io "keycloak": the object has been modified; please apply your changes to the latest version and try again
E0221 16:32:21.723581 1 reconcile_operand.go:243] Failed to parse value reference in resource 4-5-test/cs-keycloak: failed to update Route 4-5-test/keycloak: Operation cannot be fulfilled on routes.route.openshift.io "keycloak": the 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

…utdated object

Signed-off-by: Daniel Fan <fanyuchensx@gmail.com>
Copy link
Contributor

@YCShen1010 YCShen1010 left a comment

Choose a reason for hiding this comment

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

/lgtm

@ibm-ci-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Daniel-Fan, YCShen1010

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [Daniel-Fan,YCShen1010]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ibm-ci-bot ibm-ci-bot merged commit 8d3224d into IBM:master Feb 22, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants