karmada-io / karmada

Open, Multi-Cloud, Multi-Cluster Kubernetes Orchestration
https://karmada.io
Apache License 2.0
4.12k stars 807 forks source link

make DeepEqual judgments more efficient #4827

Closed zhzhuang-zju closed 2 weeks ago

zhzhuang-zju commented 2 weeks ago

What type of PR is this? /kind cleanup

What this PR does / why we need it: Function CreateOrUpdateClusterObject is used to create cluster object in karmada control plane, or update it if it has been existed. https://github.com/karmada-io/karmada/blob/da7689f715aa7c8424a6e14d99be8536f5f1f77a/pkg/util/cluster.go#L145-L151 reflect.DeepEqual(cluster.Spec, clusterObj.Spec) It doesn't make sense to compare the cluster to the clusterobj, it should be the cluster to the mutate(cluster) in order to correctly determine if an update is needed.

Which issue(s) this PR fixes: Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

XiShanYongYe-Chang commented 2 weeks ago

/assign

zhzhuang-zju commented 2 weeks ago

cc @XiShanYongYe-Chang @chaosi-zju

karmada-bot commented 2 weeks ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: chaunceyjiang

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: - ~~[pkg/util/OWNERS](https://github.com/karmada-io/karmada/blob/master/pkg/util/OWNERS)~~ [chaunceyjiang] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment