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

Add a clusterEviction plugin #3469

Merged
merged 1 commit into from
Apr 28, 2023
Merged

Conversation

Poor12
Copy link
Member

@Poor12 Poor12 commented Apr 26, 2023

What type of PR is this?
/kind feature

What this PR does / why we need it:
Add a clusterEviction plugin to filter cluster which has been evicted.

Which issue(s) this PR fixes:
Part of #3169

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

`karmada-scheduler`: Introduced `clusterEviction` plugin to skip the clusters that are in the process of eviction.

@karmada-bot karmada-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Apr 26, 2023
@karmada-bot karmada-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 26, 2023
@Poor12
Copy link
Member Author

Poor12 commented Apr 26, 2023

/assign @jwcesign

@codecov-commenter
Copy link

codecov-commenter commented Apr 26, 2023

Codecov Report

Merging #3469 (80eab7b) into master (0f84dd7) will decrease coverage by 0.14%.
The diff coverage is 100.00%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##           master    #3469      +/-   ##
==========================================
- Coverage   53.76%   53.62%   -0.14%     
==========================================
  Files         210      210              
  Lines       19123    19182      +59     
==========================================
+ Hits        10281    10287       +6     
- Misses       8290     8343      +53     
  Partials      552      552              
Flag Coverage Δ
unittests 53.62% <100.00%> (-0.14%) ⬇️

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

Impacted Files Coverage Δ
pkg/util/helper/cluster.go 100.00% <100.00%> (ø)

... and 3 files with indirect coverage changes

Copy link
Member

@jwcesign jwcesign left a comment

Choose a reason for hiding this comment

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

I think it would be beneficial to include end-to-end testing for this pull request.

@@ -0,0 +1,42 @@
package clusterevicted
Copy link
Member

Choose a reason for hiding this comment

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

I suggest that we follow the naming convention of clusteraffinity and name it clustereviction.

@jwcesign
Copy link
Member

cc @XiShanYongYe-Chang for checking

@Poor12 Poor12 force-pushed the add-filter branch 2 times, most recently from ebd61de to 6c33e76 Compare April 27, 2023 01:38
Copy link
Member

@jwcesign jwcesign left a comment

Choose a reason for hiding this comment

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

other lgtm

var taint corev1.Taint
var maxGroups, minGroups, numOfFailedClusters int
var policy *policyv1alpha1.PropagationPolicy
maxGroups = 1
Copy link
Member

Choose a reason for hiding this comment

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

maxGroups, minGroups, numOfFailedClusters := 1,1,1

Copy link
Member Author

Choose a reason for hiding this comment

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

/cc @XiShanYongYe-Chang. I follow the former code style. To be honest, I do not know which style is better.

Copy link
Member

Choose a reason for hiding this comment

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

It's just a code style, any writing is OK. Keep the overall consistency will be nice.

}

// Filter checks if the target cluster is in the GracefulEvictionTasks which means it has been evicted.
func (p *ClusterEviction) Filter(_ context.Context, bindingSpec *workv1alpha2.ResourceBindingSpec, _ *workv1alpha2.ResourceBindingStatus, cluster *clusterv1alpha1.Cluster) *framework.Result {
Copy link
Member

Choose a reason for hiding this comment

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

Does this plugin only take effect when the Application Failover feature is enabled?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not only application failover, but also the current cluster failover. See comments: #3456 (comment).

Copy link
Member

Choose a reason for hiding this comment

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

Does this conflict with the TaintToleration plugin?

Copy link
Member

Choose a reason for hiding this comment

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

I don't think there will be any conflict. The plugins will execute sequentially, ensuring that the final result does not include the cluster in eviction tasks, as intended.

Copy link
Member

Choose a reason for hiding this comment

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

ok.

@Poor12 Poor12 changed the title Add a clusterEvicted plugin Add a clusterEviction plugin Apr 27, 2023
@Poor12
Copy link
Member Author

Poor12 commented Apr 27, 2023

/assign @RainbowMango

Name = "ClusterEviction"
)

// ClusterEviction is a plugin that checks if the target cluster is in the GracefulEvictionTasks which means it has been evicted.
Copy link
Member

Choose a reason for hiding this comment

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

A cluster in eviction tasks doesn't mean it has been evicted, it means it is in the process of eviction.


var _ framework.FilterPlugin = &ClusterEviction{}

// New instantiates the APIEnablement plugin.
Copy link
Member

Choose a reason for hiding this comment

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

APIEnablement

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

Signed-off-by: Poor12 <shentiecheng@huawei.com>
Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

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

@jwcesign @chaunceyjiang Do you have any other comments? Can we move forward now?

@karmada-bot
Copy link
Collaborator

[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

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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 28, 2023
@jwcesign
Copy link
Member

/lgtm

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Apr 28, 2023
@karmada-bot karmada-bot merged commit 185c750 into karmada-io:master Apr 28, 2023
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.

7 participants