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

Fix inter-pod anti-affinity check to consider a pod a match when all the anti-affinity terms match #62715

Merged
merged 2 commits into from
Apr 18, 2018

Conversation

bsalamat
Copy link
Member

What this PR does / why we need it:
Inter-pod anti-affinity check used to incorrectly consider a pod a match when any of the anti-affinity terms matched the pod. This PR fixes the logic to consider a pod a match when all the terms match the pod.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #62567

Special notes for your reviewer:

Release note:

Fix inter-pod anti-affinity check to consider a pod a match when all the anti-affinity terms match.

/sig scheduling

@k8s-ci-robot k8s-ci-robot added 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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Apr 17, 2018
@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 17, 2018
@bsalamat bsalamat requested review from dixudx and removed request for davidopp and wojtek-t April 17, 2018 06:59
@bsalamat
Copy link
Member Author

cc @wackxu

@dixudx
Copy link
Member

dixudx commented Apr 17, 2018

@bsalamat IIUC I think this PR could be combined with #62591, which is aimed to the similar issue and easy to be cherry-picked.

They are both fixing pod affinity/anti-affinity issues. One is in raw affinity/anti-affinity terms and the other is in topology terms, which will match all the affinity/anti-affinity terms in topology side.

Also the description/title of this PR is misleading. This PR is focusing more on topology side.

@bsalamat
Copy link
Member Author

bsalamat commented Apr 17, 2018

@bsalamat IIUC I think this PR could be combined with #62591, which is aimed to the similar issue and easy to be cherry-picked.
They are both fixing pod affinity/anti-affinity issues. One is in raw affinity/anti-affinity terms and the other is in topology terms, which will match all the affinity/anti-affinity terms in topology side.

PR #62591 was targeting a different, but similar problem. That PR was intended to fix self-affinity issue, although I also fixed the anti-affinity issue in our slow path as well. This PR cannot be back-ported as it touches code that is mostly added in #62211. We could possibly back-port #62591, but even that one cannot be back-ported verbatim and needs changes.

Also the description/title of this PR is misleading. This PR is focusing more on topology side.

This PR actually fixes the issue mentioned in the title. The anti-affinity matching algorithm had a bug. The bug was not in checking topology; it was in how we combined the results of multiple anti-affinity terms.

@dixudx
Copy link
Member

dixudx commented Apr 18, 2018

/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bsalamat, dixudx

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-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 62761, 62715). If you want to cherry-pick this change to another branch, please follow the instructions here.

@k8s-github-robot k8s-github-robot merged commit 98968c3 into kubernetes:master Apr 18, 2018
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. 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. 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.

Scheduler incorrectly considers a Pod a match for inter Pod Anti-affinity terms if any of the terms matches
4 participants