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

feat(scheduler): use api server to watch scheduled pods #82338

Conversation

draveness
Copy link
Contributor

@draveness draveness commented Sep 4, 2019

/kind feature
/sig scheduling
/priority important-longterm
/assign @Huang-Wei

What this PR does / why we need it:

Use api server to watch scheduled pods instead of listing them in a for loop.

Which issue(s) this PR fixes:

ref: #81719

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

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


@k8s-ci-robot k8s-ci-robot added the release-note-none Denotes a PR that doesn't merit a release note. label Sep 4, 2019
@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. area/test sig/testing Categorizes an issue or PR as relevant to SIG Testing. labels Sep 4, 2019
@draveness draveness mentioned this pull request Sep 4, 2019
5 tasks
Copy link
Member

@Huang-Wei Huang-Wei left a comment

Choose a reason for hiding this comment

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

Generally LGTM. Some comments below.

test/integration/scheduler_perf/scheduler_bench_test.go Outdated Show resolved Hide resolved
test/integration/scheduler_perf/scheduler_bench_test.go Outdated Show resolved Hide resolved
test/integration/scheduler_perf/scheduler_test.go Outdated Show resolved Hide resolved
test/integration/scheduler_perf/scheduler_test.go Outdated Show resolved Hide resolved
test/integration/scheduler_perf/scheduler_test.go Outdated Show resolved Hide resolved
test/integration/scheduler_perf/scheduler_test.go Outdated Show resolved Hide resolved

scheduled := int32(0)
scheduledCh := make(chan struct{}, 1)
schedulerConfigArgs.PodInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
Copy link
Member

Choose a reason for hiding this comment

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

I can not remember where do we start PodInformer routine :(, do you know that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sched := scheduler.NewFromConfig(config)
scheduler.AddAllEventHandlers(sched,
v1.DefaultSchedulerName,
informerFactory.Core().V1().Nodes(),
informerFactory.Core().V1().Pods(),
informerFactory.Core().V1().PersistentVolumes(),
informerFactory.Core().V1().PersistentVolumeClaims(),
informerFactory.Core().V1().Services(),
informerFactory.Storage().V1().StorageClasses(),
informerFactory.Storage().V1beta1().CSINodes(),
)
informerFactory.Start(stopCh)
sched.Run()

It's here, please correct me if I'm wrong.

@draveness draveness force-pushed the feature/use-apiserver-in-scheduler-benchmarks branch from 421215c to 0a3a95a Compare September 5, 2019 09:29
@draveness
Copy link
Contributor Author

draveness commented Sep 5, 2019 via email

@draveness
Copy link
Contributor Author

/retest

1 similar comment
@draveness
Copy link
Contributor Author

/retest

@Huang-Wei
Copy link
Member

/lgtm
/approve

/hold
in case @k82cn has other comments.

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Sep 6, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: draveness, Huang-Wei

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 6, 2019
@draveness draveness force-pushed the feature/use-apiserver-in-scheduler-benchmarks branch from 0a3a95a to 22cf232 Compare September 11, 2019 00:54
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 11, 2019
@draveness draveness force-pushed the feature/use-apiserver-in-scheduler-benchmarks branch from 22cf232 to 591a49b Compare September 11, 2019 01:23
@draveness
Copy link
Contributor Author

/retest

@draveness
Copy link
Contributor Author

draveness commented Sep 11, 2019 via email

@draveness draveness force-pushed the feature/use-apiserver-in-scheduler-benchmarks branch from 591a49b to b9f7828 Compare September 12, 2019 02:03
@draveness draveness force-pushed the feature/use-apiserver-in-scheduler-benchmarks branch from b9f7828 to f09e8a4 Compare September 12, 2019 02:05
@draveness
Copy link
Contributor Author

@Huang-Wei @k82cn All the comments have been addressed, PTAL

@draveness
Copy link
Contributor Author

draveness commented Sep 12, 2019 via email

@Huang-Wei
Copy link
Member

@draveness is anything new introduced since the preceding review? or it's just rebasing?

@draveness
Copy link
Contributor Author

draveness commented Sep 12, 2019 via email

@draveness
Copy link
Contributor Author

draveness commented Sep 12, 2019 via email

@@ -151,39 +154,59 @@ func schedulePods(config *testConfig) int32 {
break
}
}

scheduled := int32(0)
ctx, cancelFunc := context.WithCancel(context.Background())
Copy link
Member

Choose a reason for hiding this comment

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

A nit: cancel is a more convenal name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@draveness draveness force-pushed the feature/use-apiserver-in-scheduler-benchmarks branch from f09e8a4 to ad1cf1b Compare September 14, 2019 05:14
@draveness
Copy link
Contributor Author

/retest

@k82cn
Copy link
Member

k82cn commented Sep 16, 2019

LGTM overall :)

@draveness
Copy link
Contributor Author

draveness commented Sep 16, 2019 via email

@Huang-Wei
Copy link
Member

@draveness Sure. Before /lgtm, can you resolve #82338 (comment)?

@draveness draveness force-pushed the feature/use-apiserver-in-scheduler-benchmarks branch from ad1cf1b to 54e0f47 Compare September 17, 2019 03:25
@draveness
Copy link
Contributor Author

draveness commented Sep 17, 2019 via email

@Huang-Wei
Copy link
Member

/lgtm

Thanks, @draveness .

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

/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 Sep 18, 2019
@k8s-ci-robot k8s-ci-robot merged commit 57d8750 into kubernetes:master Sep 18, 2019
@k8s-ci-robot k8s-ci-robot added this to the v1.17 milestone Sep 18, 2019
@draveness draveness deleted the feature/use-apiserver-in-scheduler-benchmarks branch October 15, 2019 04:27
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/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. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. release-note-none Denotes a PR that doesn't merit a release note. 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

4 participants