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

🐛 Ignore appliedmanifestwork crd not found error when checking managed cluster connectivity #594

Conversation

zhujian7
Copy link
Member

@zhujian7 zhujian7 commented Aug 13, 2024

Summary

This PR will fix the bug that detaching cluster gets stuck when appliedManifestWork CRD does not exist on the hosted managed cluster

Related issue(s)

Fixes #

Copy link
Contributor

openshift-ci bot commented Aug 13, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: zhujian7

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:

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

Copy link

codecov bot commented Aug 13, 2024

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Project coverage is 63.73%. Comparing base (dfa835d) to head (dc9cf5a).
Report is 1 commits behind head on main.

Files Patch % Lines
...sterletcontroller/klusterlet_cleanup_controller.go 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #594      +/-   ##
==========================================
- Coverage   63.74%   63.73%   -0.02%     
==========================================
  Files         181      181              
  Lines       14039    14042       +3     
==========================================
  Hits         8949     8949              
- Misses       4195     4198       +3     
  Partials      895      895              
Flag Coverage Δ
unit 63.73% <0.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@zhujian7
Copy link
Member Author

/cc @elgnay @qiujian16

@openshift-ci openshift-ci bot requested review from elgnay and qiujian16 August 13, 2024 08:31
@@ -220,6 +220,10 @@ func (n *klusterletCleanupController) checkConnectivity(ctx context.Context,
if err == nil {
return true, nil
}
if errors.IsNotFound(err) {
klog.Infof("AppliedManifestWork not found, klusterlet %s, ignore the resources", klusterlet.Name)
return false, nil
Copy link
Contributor

Choose a reason for hiding this comment

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

Return true or false in this situation?

Copy link
Member Author

Choose a reason for hiding this comment

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

returning true means we need to clean up resources on the managed cluster(appliedmanifestworks, namespaces,crds), here if the appliedmanifestwork CRD is not found, I think we do not need to do the cleanup on the managed cluster.

Copy link
Member Author

Choose a reason for hiding this comment

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

discussed with Le offline, As the func checkConnectivity's name suggests, not found means the connectivity is OK, so I changed to returning true here.

…cluster connectivity

Signed-off-by: zhujian <jiazhu@redhat.com>
@zhujian7 zhujian7 force-pushed the ignore-amw-notfound branch from dc9cf5a to dcfdb61 Compare August 14, 2024 06:28
@elgnay
Copy link
Contributor

elgnay commented Aug 14, 2024

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Aug 14, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit 3d8cb1e into open-cluster-management-io:main Aug 14, 2024
14 checks passed
zhujian7 added a commit to zhujian7/ocm that referenced this pull request Aug 19, 2024
…cluster connectivity (open-cluster-management-io#594)

Signed-off-by: zhujian <jiazhu@redhat.com>
zhujian7 added a commit to zhujian7/ocm that referenced this pull request Aug 19, 2024
…cluster connectivity (open-cluster-management-io#594)

Signed-off-by: zhujian <jiazhu@redhat.com>
zhujian7 added a commit to zhujian7/ocm that referenced this pull request Aug 30, 2024
…cluster connectivity (open-cluster-management-io#594)

Signed-off-by: zhujian <jiazhu@redhat.com>
openshift-merge-bot bot pushed a commit to stolostron/ocm that referenced this pull request Sep 3, 2024
…cluster connectivity (open-cluster-management-io#594) (#116)

Signed-off-by: zhujian <jiazhu@redhat.com>
openshift-cherrypick-robot pushed a commit to openshift-cherrypick-robot/ocm that referenced this pull request Sep 3, 2024
…cluster connectivity (open-cluster-management-io#594)

Signed-off-by: zhujian <jiazhu@redhat.com>
openshift-cherrypick-robot pushed a commit to openshift-cherrypick-robot/ocm that referenced this pull request Sep 3, 2024
…cluster connectivity (open-cluster-management-io#594)

Signed-off-by: zhujian <jiazhu@redhat.com>
openshift-merge-bot bot pushed a commit to stolostron/ocm that referenced this pull request Sep 4, 2024
…cluster connectivity (open-cluster-management-io#594) (#120)

Signed-off-by: zhujian <jiazhu@redhat.com>
Co-authored-by: Jian Zhu <jiazhu@redhat.com>
openshift-merge-bot bot pushed a commit to stolostron/ocm that referenced this pull request Sep 4, 2024
…cluster connectivity (open-cluster-management-io#594) (#119)

Signed-off-by: zhujian <jiazhu@redhat.com>
Co-authored-by: Jian Zhu <jiazhu@redhat.com>
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.

2 participants