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

kube-scheduler: add taints filtering logic consistent with TaintToleration plugin for PodTopologySpread plugin #112357

Merged
merged 1 commit into from Sep 17, 2022

Conversation

SataQiu
Copy link
Member

@SataQiu SataQiu commented Sep 9, 2022

What type of PR is this?

/kind bug
/kind cleanup

What this PR does / why we need it:

kube-scheduler: add taints filtering logic consistent with TaintToleration plugin for PodTopologySpread plugin

  1. extract the common filter function into helper package
  2. using it in TaintToleration and PodTopologySpread plugins

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change?

kube-scheduler: add taints filtering logic consistent with TaintToleration plugin for PodTopologySpread plugin

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. kind/bug Categorizes issue or PR as related to a bug. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Sep 9, 2022
@k8s-ci-robot
Copy link
Contributor

@SataQiu: This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Sep 9, 2022
@k8s-ci-robot k8s-ci-robot added sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Sep 9, 2022
…ation plugin for PodTopologySpread plugin

Signed-off-by: SataQiu <shidaqiu2018@gmail.com>
@k8s-ci-robot k8s-ci-robot added area/test sig/testing Categorizes an issue or PR as relevant to SIG Testing. labels Sep 10, 2022
@SataQiu
Copy link
Member Author

SataQiu commented Sep 11, 2022

/cc @kerthcet

@@ -52,7 +52,7 @@ func (tsc *topologySpreadConstraint) matchNodeInclusionPolicies(pod *v1.Pod, nod
}

if tsc.NodeTaintsPolicy == v1.NodeInclusionPolicyHonor {
if _, untolerated := v1helper.FindMatchingUntoleratedTaint(node.Spec.Taints, pod.Spec.Tolerations, nil); untolerated {
if _, untolerated := v1helper.FindMatchingUntoleratedTaint(node.Spec.Taints, pod.Spec.Tolerations, helper.DoNotScheduleTaintsFilterFunc()); untolerated {
Copy link
Member

Choose a reason for hiding this comment

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

Thanks, it's reasonable, we should filter out PreferNoSchedule ones. But we need to add more tests to cover this, maybe in TestPreFilterStateAddPod, TestPreFilterState and TestPodTopologySpreadScore, not too much, but we should cover them.

Copy link
Member Author

Choose a reason for hiding this comment

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

make sense

Copy link
Member

Choose a reason for hiding this comment

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

This change makes sense, but I am looking at the usage of the function matchNodeInclusionPolicies; in

!constraint.matchNodeInclusionPolicies(updatedPod, node, requiredSchedulingTerm) {
we are calling the function while checking the nodeAffinity constraints of the preemptor pod, but for taints we are checking the ones of the pod we are adding/removing from the node, this is also not correct. We need to fix that and add unit tests and patch both fixes back.

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 a big mistake made by me before, I'll fix it ASAP.

Copy link
Member Author

@SataQiu SataQiu Sep 17, 2022

Choose a reason for hiding this comment

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

It's a big mistake made by me before, I'll fix it ASAP.

Hi @kerthcet
I'd like to cherry-pick it to 1.25, then you can further fix the related problems based on this.

Copy link
Member

Choose a reason for hiding this comment

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

Already fixed, see #112507, I should broadcast it. Sorry for that.

@SataQiu
Copy link
Member Author

SataQiu commented Sep 13, 2022

@ahg-g for more review about this.

@ahg-g
Copy link
Member

ahg-g commented Sep 16, 2022

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 16, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahg-g, SataQiu

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 16, 2022
@ahg-g
Copy link
Member

ahg-g commented Sep 16, 2022

please send a patch for 1.25

@k8s-triage-robot
Copy link

The Kubernetes project has merge-blocking tests that are currently too flaky to consistently pass.

This bot retests PRs for certain kubernetes repos according to the following rules:

  • The PR does have any do-not-merge/* labels
  • The PR does not have the needs-ok-to-test label
  • The PR is mergeable (does not have a needs-rebase label)
  • The PR is approved (has cncf-cla: yes, lgtm, approved labels)
  • The PR is failing tests required for merge

You can:

/retest

@k8s-ci-robot k8s-ci-robot merged commit 3e5e5cc into kubernetes:master Sep 17, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.26 milestone Sep 17, 2022
k8s-ci-robot added a commit that referenced this pull request Oct 4, 2022
…357-upstream-release-1.25

Automated cherry pick of #112357: kube-scheduler: add taints filtering logic consistent with
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. area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. sig/testing Categorizes an issue or PR as relevant to SIG Testing. 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