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

Disable matching on few selectors. Remove duplicates. #72801

Merged
merged 1 commit into from
Jan 15, 2019

Conversation

Ramyak
Copy link
Contributor

@Ramyak Ramyak commented Jan 11, 2019

What type of PR is this?

/kind bug

What this PR does / why we need it:
Problem: When there are 2 selectors(eg: service and replication controller), it is sufficient to match any one selector for distribution. This creates imbalance [selector match code].

Pods from previous deploys matches service selector and are counted when distributing pods across zones/nodes (Even though they do not match replicaset selector) . These pods will be deleted. After the deploy completes, the cluster is imbalanced - by zone and/or pods per node.

Fix: All selectors must match pods. Partial matches are still allowed.

Which issue(s) this PR fixes:
Fixes #71327

Special notes for your reviewer:
#71328
Splitting this into 2 reviews.

Does this PR introduce a user-facing change?:

Fix SelectorSpreadPriority scheduler to match all selectors when distributing pods.

/sig scheduling

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. kind/bug Categorizes issue or PR as related to a bug. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 11, 2019
@k8s-ci-robot
Copy link
Contributor

Hi @Ramyak. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@wgliang
Copy link
Contributor

wgliang commented Jan 11, 2019

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 11, 2019
@Ramyak Ramyak force-pushed the ramya/match-all-selectors branch 2 times, most recently from a50dc68 to a56a7de Compare January 11, 2019 16:07
@Ramyak
Copy link
Contributor Author

Ramyak commented Jan 11, 2019

/test pull-kubernetes-e2e-gce-100-performance
/test pull-kubernetes-integration
/test pull-kubernetes-kubemark-e2e-gce-big

@Ramyak
Copy link
Contributor Author

Ramyak commented Jan 11, 2019

/assign @k82cn
/assign @bsalamat

Copy link
Member

@bsalamat bsalamat left a comment

Choose a reason for hiding this comment

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

Thanks, @Ramyak for the fix. Could you please address my comment?

pkg/scheduler/algorithm/priorities/selector_spreading.go Outdated Show resolved Hide resolved
Copy link
Member

@bsalamat bsalamat left a comment

Choose a reason for hiding this comment

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

This PR addresses "Problem 2" of #71327, but it is a diversion from the existing behavior. Our existing code gets a union of all pods that match any of the selectors. This PR changes the union to an intersection operator. While I don't have a particular scenario in mind that would break if someone uses a standard collection, it is easy to find scenarios where pods with custom labels will no longer spread properly after this change. For that reason, I would like to think a bit more about this PR before I can approve it.

pkg/scheduler/algorithm/priorities/selector_spreading.go Outdated Show resolved Hide resolved
pkg/scheduler/algorithm/priorities/selector_spreading.go Outdated Show resolved Hide resolved
Copy link
Member

@bsalamat bsalamat left a comment

Choose a reason for hiding this comment

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

/approve

I thought more about this change and given that the pattern mentioned in the issue can happen for many users, I decided to approve it.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

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 Jan 15, 2019
Copy link
Member

@bsalamat bsalamat left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 15, 2019
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Jan 15, 2019
@bsalamat bsalamat added the priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. label Jan 15, 2019
@k8s-ci-robot k8s-ci-robot removed the needs-priority Indicates a PR lacks a `priority/foo` label and requires one. label Jan 15, 2019
@Ramyak
Copy link
Contributor Author

Ramyak commented Jan 15, 2019

/test pull-kubernetes-e2e-gce-100-performance
/test pull-kubernetes-integration

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. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. 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/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SelectorSpreadPriority does not spread pods across zones
5 participants