Skip to content

scheduler: remove direct import to pkg/master/ports #90000

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

Merged
merged 1 commit into from
Apr 11, 2020

Conversation

SataQiu
Copy link
Member

@SataQiu SataQiu commented Apr 9, 2020

What type of PR is this?
/kind cleanup

What this PR does / why we need it:
scheduler: remove direct import to pkg/master/ports

Which issue(s) this PR fixes:

Ref #89930

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.:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Apr 9, 2020
@k8s-ci-robot k8s-ci-robot requested review from damemi and davidopp April 9, 2020 10:18
@k8s-ci-robot k8s-ci-robot added sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Apr 9, 2020
Copy link
Member

@damemi damemi left a comment

Choose a reason for hiding this comment

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

Thanks, this is exactly the kind of cleanup we're looking for, but I think it can go a little further.

Looking at usages of the ports.InsecureSchedulerPort const, there are only 3 places it's used (outside of the scheduler where you've already updated it):

Can we update these places to use the new const location from within the scheduler, and remove it from pkg/master/ports?

// May be overridden by a flag at startup.
// Copied from pkg/master/ports/ports.go
// TODO: Import this constant from a consts only package, that does not pull any further dependencies.
KubeSchedulerPort = 10259
Copy link
Member

Choose a reason for hiding this comment

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

Adding to #90000 (review), this is the only location that KubeSchedulerPort is used, so it could be removed from pkg/master/ports. Though I think this may be better declared in one of the APIs than cmd/kube-scheduler, but I'll let someone else comment on that. @Huang-Wei wdyt?

Copy link
Member

Choose a reason for hiding this comment

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

IMO we should move this along with InsecureSchedulerPort to pkg/scheduler/apis/config/types.go.

// Copied from pkg/master/ports/ports.go
// TODO: Import this constant from a consts only package, that does not pull any further dependencies.
// Deprecated: use the secure KubeSchedulerPort instead.
InsecureSchedulerPort = 10251
Copy link
Member

Choose a reason for hiding this comment

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

Maybe better to move this to pkg/scheduler/apis/config/types.go.

@SataQiu SataQiu force-pushed the staging-scheduler-20200409 branch from 6948929 to 0f47f3c Compare April 10, 2020 14:08
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. area/test 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/network Categorizes an issue or PR as relevant to SIG Network. sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Apr 10, 2020
Copy link
Member

@damemi damemi 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 Apr 10, 2020
@Huang-Wei
Copy link
Member

/retest
/approve

@liggitt To not duplicate defining InsecureSchedulerPort and KubeSchedulerPort, this PR replaced deps from pkg/master/ports to pkg/scheduler/apis/config in package pkg/registry/core/test, does it look good to you?

// InsecureSchedulerPort is the default port for the scheduler status server.
// May be overridden by a flag at startup.
// Deprecated: use the secure KubeSchedulerPort instead.
InsecureSchedulerPort = 10251
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
InsecureSchedulerPort = 10251
DefaultInsecureSchedulerPort = 10251

// Deprecated: use the secure KubeSchedulerPort instead.
InsecureSchedulerPort = 10251

// KubeSchedulerPort is the default port for the scheduler status server.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// KubeSchedulerPort is the default port for the scheduler status server.
// DefaultKubeSchedulerPort is the default port for the scheduler status server.

@@ -340,7 +341,7 @@ type componentStatusStorage struct {
func (s componentStatusStorage) serversToValidate() map[string]*componentstatus.Server {
serversToValidate := map[string]*componentstatus.Server{
"controller-manager": {Addr: "127.0.0.1", Port: ports.InsecureKubeControllerManagerPort, Path: "/healthz"},
"scheduler": {Addr: "127.0.0.1", Port: ports.InsecureSchedulerPort, Path: "/healthz"},
"scheduler": {Addr: "127.0.0.1", Port: kubeschedulerconfig.InsecureSchedulerPort, Path: "/healthz"},
Copy link
Member

Choose a reason for hiding this comment

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

add a comment indicating this is fragile and assumes the default port is being used

@liggitt
Copy link
Member

liggitt commented Apr 10, 2020

a couple comments, lgtm otherwise

Signed-off-by: SataQiu <1527062125@qq.com>
@SataQiu SataQiu force-pushed the staging-scheduler-20200409 branch from 0f47f3c to 41d3e44 Compare April 11, 2020 05:57
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 11, 2020
@liggitt
Copy link
Member

liggitt commented Apr 11, 2020

/lgtm
/approve

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Huang-Wei, liggitt, 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 Apr 11, 2020
@k8s-ci-robot k8s-ci-robot merged commit ee6b88d into kubernetes:master Apr 11, 2020
@k8s-ci-robot k8s-ci-robot added this to the v1.19 milestone Apr 11, 2020
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/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. release-note-none Denotes a PR that doesn't merit a release note. 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/network Categorizes an issue or PR as relevant to SIG Network. 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/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.

5 participants