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

🌱 Remove unnecessary code for removing managed cluster resources #330

Conversation

xuezhaojun
Copy link
Member

@xuezhaojun xuezhaojun commented Dec 7, 2023

Summary

When hubAcceptsClient toggle between true and false, we want to keep the resources.

The resources we want to keep are:

        // Hub cluster-admin accepts the spoke cluster, we apply
	// 1. clusterrole and clusterrolebinding for this spoke cluster.
	// 2. namespace for this spoke cluster.
	// 3. role and rolebinding for this spoke cluster on its namespace.
	resourceResults := c.applier.Apply(
		ctx,
		syncCtx.Recorder(),
		helpers.ManagedClusterAssetFn(manifests.RBACManifests, managedClusterName),
		staticFiles...,
	)

If the namespace of the spoke cluster removed, then all manifestwork applied in that namespace will also gone. We want to avoid that.

Related issue(s)

Fixes #

cluster resources

Signed-off-by: xuezhaojun <zxue@redhat.com>
@openshift-ci openshift-ci bot requested review from elgnay and skeeey December 7, 2023 08:37
Copy link
Contributor

openshift-ci bot commented Dec 7, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: xuezhaojun
Once this PR has been reviewed and has the lgtm label, please assign skeeey for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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 Dec 7, 2023

Codecov Report

Attention: 52 lines in your changes are missing coverage. Please review.

Comparison is base (f89d535) 61.75% compared to head (0d64be1) 61.64%.
Report is 3 commits behind head on main.

Files Patch % Lines
pkg/registration/hub/lease/clocksynccontroller.go 42.85% 47 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #330      +/-   ##
==========================================
- Coverage   61.75%   61.64%   -0.12%     
==========================================
  Files         132      133       +1     
  Lines       13992    14070      +78     
==========================================
+ Hits         8641     8673      +32     
- Misses       4585     4628      +43     
- Partials      766      769       +3     
Flag Coverage Δ
unit 61.64% <42.85%> (-0.12%) ⬇️

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.

@xuezhaojun
Copy link
Member Author

/assign @qiujian16

@qiujian16
Copy link
Member

hrm I do not thin we remove ns right now... @skeeey ?

@skeeey
Copy link
Member

skeeey commented Dec 8, 2023

we will keep the ns when a managed cluster is denied, only remove https://github.com/open-cluster-management-io/ocm/blob/main/pkg/registration/hub/managedcluster/controller.go#L31

@xuezhaojun
Copy link
Member Author

I see a related TODO in the code:

// TODO consider to add the managedcluster-namespace.yaml back to staticFiles,

Is this means we tend to add namespace back to staicFiles?

@skeeey
Copy link
Member

skeeey commented Dec 8, 2023

we may, but it's difficult to handle the namespace, because there are too many cases we need consider (like the acm import controller does)

@xuezhaojun xuezhaojun closed this Dec 19, 2023
@xuezhaojun xuezhaojun deleted the keep-manifestworks-after-hubclientaccept-set-to-false branch December 19, 2023 07:20
mprahl pushed a commit to mprahl/OCM that referenced this pull request Mar 14, 2024
Signed-off-by: ldpliu <daliu@redhat.com>
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.

3 participants