karmada
karmada copied to clipboard
Refactor the func and event of taint cluster
Signed-off-by: Poor12 [email protected]
What type of PR is this? /kind cleanup
What this PR does / why we need it: Refactor:
- Now the former
UpdateClusterControllerTaint
is an unclear naming. Changed toUpdateClusterTaints
. -
UpdateClusterControllerTaint
do two things. The first is generate the updated taints based on the taintsAdd and taintsRemove. The Second is update the cluster taints which is generated above. Splitting functions makes responsibilities more single. -
updateClusterTaints
should be a method of the cluster-controller by its responsibility. This is also good for joining events. -
RemoveTargetClusterFailed
is triggered by updating the termating taint failure. It should be merged intoTaintClusterFailed
.
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal TaintClusterSucceed 34s cluster-controller Taint cluster succeed: cluster now has taints([{cluster.karmada.io/not-ready NoSchedule 2022-11-03 11:54:48.035154046 +0000 UTC m=+117.616029025}]).
Normal TaintClusterSucceed 34s cluster-controller Taint cluster succeed: cluster now has taints([]).
Which issue(s) this PR fixes: Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
`Instrumentation`: Introduced the `TaintClusterSucceed` event to `Cluster` object and merged `TaintClusterByConditionFailed` and `RemoveTargetClusterFailed` to `TaintClusterFailed`.
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by:
To complete the pull request process, please assign kevin-wangzefeng after the PR has been reviewed.
You can assign the PR to them by writing /assign @kevin-wangzefeng
in a comment when ready.
The full list of commands accepted by this bot can be found here.
Approvers can indicate their approval by writing /approve
in a comment
Approvers can cancel approval by writing /approve cancel
in a comment
@jwcesign please take a look.
/lgtm
cc @RainbowMango
/cc @RainbowMango
Hi @Poor12 Sorry for letting this sit, do you think this is still needed? If yes, could you please solve the conflicts, I can take a look this week.
Thanks. I have solved the conflicts.
/hold The unit test is failing.
=== RUN TestSetCurrentClusterTaints
=== RUN TestSetCurrentClusterTaints/ready_condition_from_true_to_false
=== RUN TestSetCurrentClusterTaints/ready_condition_from_true_to_unknown
=== RUN TestSetCurrentClusterTaints/ready_condition_from_false_to_unknown
=== RUN TestSetCurrentClusterTaints/ready_condition_from_false_to_true
=== RUN TestSetCurrentClusterTaints/ready_condition_from_unknown_to_true
=== RUN TestSetCurrentClusterTaints/ready_condition_from_unknown_to_false
=== RUN TestSetCurrentClusterTaints/clusterTaintsToAdd_is_nil_and_clusterTaintsToRemove_is_nil
taint_test.go:115: Cluster gotTaints = [], want [{cluster.karmada.io/unreachable NoExecute <nil>}]
--- FAIL: TestSetCurrentClusterTaints (0.00s)
--- PASS: TestSetCurrentClusterTaints/ready_condition_from_true_to_false (0.00s)
--- PASS: TestSetCurrentClusterTaints/ready_condition_from_true_to_unknown (0.00s)
--- PASS: TestSetCurrentClusterTaints/ready_condition_from_false_to_unknown (0.00s)
--- PASS: TestSetCurrentClusterTaints/ready_condition_from_false_to_true (0.00s)
--- PASS: TestSetCurrentClusterTaints/ready_condition_from_unknown_to_true (0.00s)
--- PASS: TestSetCurrentClusterTaints/ready_condition_from_unknown_to_false (0.00s)
--- FAIL: TestSetCurrentClusterTaints/clusterTaintsToAdd_is_nil_and_clusterTaintsToRemove_is_nil (0.00s)
/cc @XiShanYongYe-Chang for e2e.
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: RainbowMango
The full list of commands accepted by this bot can be found here.
The pull request process is described here
- ~~OWNERS~~ [RainbowMango]
Approvers can indicate their approval by writing /approve
in a comment
Approvers can cancel approval by writing /approve cancel
in a comment
/hold cancel