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

Introduce --enable-cluster-resource-modeling to customize resource modeling feature #2387

Merged

Conversation

RainbowMango
Copy link
Member

What type of PR is this?
/kind feature

What this PR does / why we need it:
This PR actually takes over #1858, fixed comments.

Which issue(s) this PR fixes:
Fixes #1858

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

`karmada-controller-manager`/`karmada-agent`: Introduced `--enable-cluster-resource-modeling` flag to enable or disable cluster modeling feature.

Signed-off-by: jingxueli <jingxueli@trip.com>
@karmada-bot karmada-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Aug 16, 2022
@karmada-bot karmada-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 16, 2022
@RainbowMango
Copy link
Member Author

@dddddai Could you please take a look?

cc guys who might be interested in it.
@garfcat @likakuli

@RainbowMango RainbowMango force-pushed the pr_resource_modeling_control_flag branch from 6c88217 to 214cff2 Compare August 16, 2022 13:30
Copy link
Member

@dddddai dddddai left a comment

Choose a reason for hiding this comment

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

Looks good!

/lgtm

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Aug 17, 2022
@RainbowMango RainbowMango added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 17, 2022
@RainbowMango RainbowMango force-pushed the pr_resource_modeling_control_flag branch from 214cff2 to 6495f80 Compare August 17, 2022 03:46
@karmada-bot karmada-bot removed the lgtm Indicates that a PR is ready to be merged. label Aug 17, 2022
@RainbowMango RainbowMango removed the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 17, 2022
@RainbowMango
Copy link
Member Author

I forgot to add the controller parameters at here, that's the root cause of the CI failure.

}
if c.EnableClusterResourceModeling {
// get or create informer for pods and nodes in member cluster
clusterInformerManager, err := c.buildInformerForCluster(clusterClient)
Copy link
Member Author

Choose a reason for hiding this comment

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

The buildInformerForCluster now helps to initialize the informer for clusters, the informer will be used by other controllers.
We must de-coupling it before moving this forward.
/hold

Copy link
Member

Choose a reason for hiding this comment

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

+1
The current control coupling is a little severe.

Copy link
Member

@dddddai dddddai Aug 17, 2022

Choose a reason for hiding this comment

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

Maybe we can build the generic informer as usual but not build the typed informer(just for cluster modeling) in buildInformerForCluster?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's definitely a workable solution.

But the annoying thing is it's a bad program paradigm. Too much coupling leads to hard to maintain.
Now, the multi-cluster-informer-manager is initialized by cluster-status-controller but used by execution-controller , and work-status-controller. :(

I'm trying to decouple them.

@karmada-bot karmada-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 17, 2022
@RainbowMango RainbowMango added this to the v1.3 milestone Aug 17, 2022
@karmada-bot karmada-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 17, 2022
@RainbowMango
Copy link
Member Author

I just pushed two more commits, the first one is used to address the temporary solution, and the last one is just for verification and it will be removed before moving forward.

Signed-off-by: RainbowMango <qdurenhongcai@gmail.com>
@RainbowMango RainbowMango force-pushed the pr_resource_modeling_control_flag branch from 0926e6c to 95036ff Compare August 17, 2022 08:34
@RainbowMango
Copy link
Member Author

ready for review again :) @dddddai

dynamicClient, err := c.ClusterDynamicClientSetFunc(clusterClient.ClusterName, c.Client)
if err != nil {
klog.Errorf("Failed to build dynamic cluster client for cluster %s.", clusterClient.ClusterName)
return
Copy link
Member

Choose a reason for hiding this comment

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

Should we return err? (keep the behavior as before)

Copy link
Member Author

Choose a reason for hiding this comment

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

I think just one log is enough.
Even in case of error, what else can the cluster status controller do except log again the error?
The error shouldn't block the normal process.

@dddddai
Copy link
Member

dddddai commented Aug 17, 2022

/lgtm

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Aug 17, 2022
@RainbowMango RainbowMango added approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Aug 17, 2022
@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

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

@karmada-bot karmada-bot merged commit ccc39b2 into karmada-io:master Aug 17, 2022
@RainbowMango RainbowMango deleted the pr_resource_modeling_control_flag branch February 20, 2023 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants