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

Graduate kube-scheduler NodeInclusionPolicy to beta #113500

Conversation

kerthcet
Copy link
Member

@kerthcet kerthcet commented Nov 1, 2022

Signed-off-by: kerthcet kerthcet@gmail.com

What type of PR is this?

/kind feature
/sig scheduling

What this PR does / why we need it:

Graduate NodeInclusionPolicy to beta, only api part.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?

NodeInclusionPolicy in podTopologySpread plugin is enabled by default. 

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

- KEP: https://github.com/kubernetes/enhancements/issues/3094

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. kind/feature Categorizes issue or PR as related to a new feature. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. 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. area/code-generation kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/apps Categorizes an issue or PR as relevant to SIG Apps. labels Nov 1, 2022
@kerthcet
Copy link
Member Author

kerthcet commented Nov 1, 2022

/remove-sig apps api-machinery

@k8s-ci-robot k8s-ci-robot removed sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. labels Nov 1, 2022
@kerthcet kerthcet force-pushed the feat/graduate-nodeInclusionPoplicy-to-beta branch from f609164 to b036034 Compare November 1, 2022 06:58
@k8s-ci-robot k8s-ci-robot added sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/apps Categorizes an issue or PR as relevant to SIG Apps. labels Nov 1, 2022
@kerthcet
Copy link
Member Author

kerthcet commented Nov 1, 2022

/test pull-kubernetes-unit

Signed-off-by: kerthcet <kerthcet@gmail.com>
@kerthcet kerthcet force-pushed the feat/graduate-nodeInclusionPoplicy-to-beta branch from b036034 to 8d78b37 Compare November 1, 2022 08:07
@kerthcet
Copy link
Member Author

kerthcet commented Nov 1, 2022

/retest

@kerthcet
Copy link
Member Author

kerthcet commented Nov 2, 2022

This is the benchmark results for nodeInclusionPolicy:

1) 500 nodes:
NodeInclusionPolicy disabled:
BenchmarkPerfScheduling/SchedulingWithNodeInclusionPolicy/500Nodes-8     1    42853905745 ns/op
ok  	k8s.io/kubernetes/test/integration/scheduler_perf    62.579s

NodeInclusionPolicy enabled:
BenchmarkPerfScheduling/SchedulingWithNodeInclusionPolicy/500Nodes-8     1    42976119234 ns/op
ok  	k8s.io/kubernetes/test/integration/scheduler_perf    62.711s

2) 5000 nodes:
NodeInclusionPolicy disabled:
BenchmarkPerfScheduling/SchedulingWithNodeInclusionPolicy/5000Nodes-8     1    383803119491 ns/op
ok  	k8s.io/kubernetes/test/integration/scheduler_perf    555.560s

NodeInclusionPolicy enabled:
BenchmarkPerfScheduling/SchedulingWithNodeInclusionPolicy/5000Nodes-8     1    388210043641 ns/op
ok  	k8s.io/kubernetes/test/integration/scheduler_perf    560.219s

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 2, 2022
@kerthcet kerthcet changed the title WIP: Graduate NodeInclusionPolicy to beta Graduate NodeInclusionPolicy to beta Nov 2, 2022
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 2, 2022
@liggitt liggitt added this to Assigned in API Reviews Nov 2, 2022
Copy link
Member

@liggitt liggitt left a comment

Choose a reason for hiding this comment

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

API plumbing lgtm, will defer benchmark review and test change to scheduling reviewer

@@ -119,7 +119,7 @@ func (p *IntegrationTestNodePreparer) PrepareNodes(nextNodeIndex int) error {
func (p *IntegrationTestNodePreparer) CleanupNodes() error {
// TODO(#93794): make CleanupNodes only clean up the nodes created by this
// IntegrationTestNodePreparer to make this more intuitive.
nodes, err := GetReadySchedulableNodes(p.client)
Copy link
Member

Choose a reason for hiding this comment

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

curious why this change was needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

When creating nodes with taints, all these nodes are unschedulable to normal pods, so we'll always return error after calling Filter(). That means no node satisfied.

checkWaitListSchedulableNodes will return all nodes with spec.unschedulable is false, the only difference here is we'll patch more nodes than before, who will not be scheduled pods. So I think it's ok.

Copy link
Member

Choose a reason for hiding this comment

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

This actually impacts all existing tests' behavior to skip nodes' health check. I'm a bit concerned on this. Can you add a param in workloadTemplate to make the behavior of "ignoring node health check or not" an option?

Copy link
Member

Choose a reason for hiding this comment

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

Should we make the parameter ignore taints, instead of ignoring isNodeSchedulable?

Copy link
Member

Choose a reason for hiding this comment

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

although... why did we even care about getting Ready nodes in the first place? I don't think we have any test cases with non-ready nodes.

Copy link
Member Author

@kerthcet kerthcet Nov 3, 2022

Choose a reason for hiding this comment

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

Add a param is one approach, but try to figure out the reason why we want to filter out taint nodes here. They're actually schedulable if pod tolerates the taints.

Filter(nodes, func(node v1.Node) bool {
return IsNodeSchedulable(&node) && isNodeUntainted(&node)
})

I think the change won't impact present tests for we have no taint-related or node-not-ready cases. But in theory, filtering out non-ready nodes when updating patches makes sense to me for the sake of performance especially we have thousands of nodes.

Another question here is when cleaning up, we only remove the readySchedulableNodes nodes, but we should remove all nodes created by itself. I used to submit a PR to fix this here #112237.

So in summary:

  1. When calling PrepareNodes, I'll get ready and schedulable nodes including nodes with taints
  2. When calling CleanupNodes, I'll remove all nodes created by itself as Remove only prepared nodes in performance tests #112237.

WDYT?

Copy link
Member

Choose a reason for hiding this comment

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

I think we can prepare and cleanup all nodes, given that we always create them as ready (there are no kubelets running in our tests).

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we can prepare and cleanup all nodes, given that we always create them as ready (there are no kubelets running in our tests).

I'm ok with this. Also looking forward to @Huang-Wei 's advices.

Copy link
Member Author

Choose a reason for hiding this comment

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

Created a separate PR here #113615 to make this a pure one, only focus on the API part.

test/integration/framework/util.go Outdated Show resolved Hide resolved
@liggitt liggitt moved this from Assigned to API review completed, 1.26 in API Reviews Nov 2, 2022
@liggitt liggitt added the api-review Categorizes an issue or PR as actively needing an API review. label Nov 2, 2022
@kerthcet kerthcet force-pushed the feat/graduate-nodeInclusionPoplicy-to-beta branch from 6bd7dcb to 64adc8b Compare November 2, 2022 14:14
@kerthcet
Copy link
Member Author

kerthcet commented Nov 2, 2022

The test pull-kubernetes-e2e-kind failed mostly related to #113547

Copy link
Member

@alculquicondor alculquicondor left a comment

Choose a reason for hiding this comment

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

/approve
/hold for nits

@@ -119,7 +119,7 @@ func (p *IntegrationTestNodePreparer) PrepareNodes(nextNodeIndex int) error {
func (p *IntegrationTestNodePreparer) CleanupNodes() error {
// TODO(#93794): make CleanupNodes only clean up the nodes created by this
// IntegrationTestNodePreparer to make this more intuitive.
nodes, err := GetReadySchedulableNodes(p.client)
Copy link
Member

Choose a reason for hiding this comment

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

Should we make the parameter ignore taints, instead of ignoring isNodeSchedulable?

@@ -119,7 +119,7 @@ func (p *IntegrationTestNodePreparer) PrepareNodes(nextNodeIndex int) error {
func (p *IntegrationTestNodePreparer) CleanupNodes() error {
// TODO(#93794): make CleanupNodes only clean up the nodes created by this
// IntegrationTestNodePreparer to make this more intuitive.
nodes, err := GetReadySchedulableNodes(p.client)
Copy link
Member

Choose a reason for hiding this comment

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

although... why did we even care about getting Ready nodes in the first place? I don't think we have any test cases with non-ready nodes.

test/integration/framework/util.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 2, 2022
@kerthcet kerthcet force-pushed the feat/graduate-nodeInclusionPoplicy-to-beta branch from 64adc8b to 8d78b37 Compare November 4, 2022 03:45
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 4, 2022
@kerthcet
Copy link
Member Author

kerthcet commented Nov 4, 2022

Hold until #113615 got merged first.
/hold

@alculquicondor
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 4, 2022
@kerthcet
Copy link
Member Author

kerthcet commented Nov 7, 2022

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 7, 2022
@kerthcet
Copy link
Member Author

kerthcet commented Nov 7, 2022

/assign @liggitt

@liggitt
Copy link
Member

liggitt commented Nov 7, 2022

/approve
for API bits

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alculquicondor, kerthcet, liggitt

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 Nov 7, 2022
@k8s-ci-robot k8s-ci-robot merged commit c326b27 into kubernetes:master Nov 8, 2022
@kerthcet kerthcet deleted the feat/graduate-nodeInclusionPoplicy-to-beta branch November 8, 2022 00:01
@k8s-ci-robot k8s-ci-robot added this to the v1.26 milestone Nov 8, 2022
@fedebongio
Copy link
Contributor

/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-review Categorizes an issue or PR as actively needing an API review. approved Indicates a PR has been approved by an approver from all required OWNERS files. area/code-generation area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API kind/feature Categorizes issue or PR as related to a new feature. 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. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/apps Categorizes an issue or PR as relevant to SIG Apps. 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/S Denotes a PR that changes 10-29 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Status: API review completed, 1.26
Development

Successfully merging this pull request may close these issues.

None yet

7 participants