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

Use Reader.Get() to retrieve the resource outside of cache scope #2315

Merged
merged 2 commits into from
Nov 28, 2024

Conversation

YCShen1010
Copy link
Contributor

@YCShen1010 YCShen1010 commented Nov 28, 2024

What this PR does:

This is an issue where resources outside the runtime cache scope caused errors during retrieval and deletion. Using Reader.Get() instead of Client.Get in deleteResource function to bypass the cache when necessary, ensuring reliable access to all resources.

Issue: https://github.ibm.com/IBMPrivateCloud/roadmap/issues/65386

How to test

Test image: quay.io/yuchen_shen/cs_operator:error_msg

  1. Install v4 in single namespace
  2. See the following error msg:
I1128 16:04:26.927875 1 init.go:960] MutatingWebhookConfiguration /ibm-common-service-webhook-configuration not found, skipping deletion
I1128 16:04:26.931228 1 init.go:960] MutatingWebhookConfiguration /ibm-operandrequest-webhook-configuration not found, skipping deletion
I1128 16:04:26.934923 1 init.go:960] ValidatingWebhookConfiguration /ibm-cs-ns-mapping-webhook-configuration not found, skipping deletion
I1128 16:04:26.939207 1 init.go:960] PodPreset error/ibm-common-service-webhook not found, skipping deletion
I1128 16:04:26.939241 1 init.go:960] ServiceAccount error/ibm-common-service-webhook not found, skipping deletion
I1128 16:04:26.939254 1 init.go:960] Role error/ibm-common-service-webhook not found, skipping deletion
I1128 16:04:26.939266 1 init.go:960] RoleBinding error/ibm-common-service-webhook not found, skipping deletion
E1128 16:04:26.939300 1 init.go:872] Error deleting webhook resources: unable to get: /ibm-common-service-webhook because of unknown namespace for the cache
I1128 16:04:26.939310 1 init.go:960] ServiceAccount error/secretshare not found, skipping deletion
E1128 16:04:26.939316 1 init.go:876] Error deleting secretshare resources: unable to get: /secretshare because of unknown namespace for the cache
I1128 16:04:26.939325 1 init.go:222] Checking if OperandRegistry and OperandConfig CRD already exist
  1. Apply the test image, the error msg will be gone:
I1128 16:21:33.928733 1 init.go:841] Extracting Keycloak themes from jar file
I1128 16:21:33.953978 1 init.go:961] MutatingWebhookConfiguration /ibm-common-service-webhook-configuration not found, skipping deletion
I1128 16:21:33.956404 1 init.go:961] MutatingWebhookConfiguration /ibm-operandrequest-webhook-configuration not found, skipping deletion
I1128 16:21:33.959790 1 init.go:961] ValidatingWebhookConfiguration /ibm-cs-ns-mapping-webhook-configuration not found, skipping deletion
I1128 16:21:33.962589 1 init.go:961] PodPreset error/ibm-common-service-webhook not found, skipping deletion
I1128 16:21:33.964579 1 init.go:961] ServiceAccount error/ibm-common-service-webhook not found, skipping deletion
I1128 16:21:33.966986 1 init.go:961] Role error/ibm-common-service-webhook not found, skipping deletion
I1128 16:21:33.969962 1 init.go:961] RoleBinding error/ibm-common-service-webhook not found, skipping deletion
I1128 16:21:33.972802 1 init.go:961] ClusterRole /ibm-common-service-webhook not found, skipping deletion
I1128 16:21:33.976598 1 init.go:961] ClusterRoleBinding /ibm-common-service-webhook-error not found, skipping deletion
I1128 16:21:33.979181 1 init.go:961] Deployment error/ibm-common-service-webhook not found, skipping deletion
I1128 16:21:33.982111 1 init.go:961] ServiceAccount error/secretshare not found, skipping deletion
I1128 16:21:33.984900 1 init.go:961] ClusterRole /secretshare not found, skipping deletion
I1128 16:21:33.987555 1 init.go:961] ClusterRoleBinding /secretshare-error not found, skipping deletion
I1128 16:21:33.990717 1 init.go:961] SecretShare Operator CR error/common-service not found, skipping deletion
I1128 16:21:33.993244 1 init.go:961] Deployment error/secretshare not found, skipping deletion
I1128 16:21:33.993263 1 init.go:222] Checking if OperandRegistry and OperandConfig CRD already exist
  1. The warning msg that is showing the resources are not found, skipping deletion is also hidden, so the final log looks like
I1128 16:28:56.212313 1 init.go:841] Extracting Keycloak themes from jar file
I1128 16:28:56.297247 1 init.go:222] Checking if OperandRegistry and OperandConfig CRD already exist

Signed-off-by: YuChen <yuchen.shen@mail.utoronto.ca>
Signed-off-by: YuChen <yuchen.shen@mail.utoronto.ca>
@YCShen1010 YCShen1010 changed the title Use Reader.get to retrieve the resource outside of cache scope Use Reader.Get() to retrieve the resource outside of cache scope Nov 28, 2024
Copy link
Contributor

@Daniel-Fan Daniel-Fan 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 663f903 into IBM:master Nov 28, 2024
6 of 9 checks passed
@YCShen1010 YCShen1010 deleted the error branch November 28, 2024 17:20
YCShen1010 added a commit to YCShen1010/ibm-common-service-operator that referenced this pull request Nov 28, 2024
…#2315)

* use Reader.get to retrieve the resource outside of ns

Signed-off-by: YuChen <yuchen.shen@mail.utoronto.ca>

* hide the msg when the resources are not found for deletion

Signed-off-by: YuChen <yuchen.shen@mail.utoronto.ca>

---------

Signed-off-by: YuChen <yuchen.shen@mail.utoronto.ca>
ibm-ci-bot pushed a commit that referenced this pull request Nov 28, 2024
…) (#2316)

* use Reader.get to retrieve the resource outside of ns



* hide the msg when the resources are not found for deletion



---------

Signed-off-by: YuChen <yuchen.shen@mail.utoronto.ca>
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