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

Introduce internal channels for scheduler #84336

Closed

Conversation

hprateek43
Copy link
Contributor

@hprateek43 hprateek43 commented Oct 25, 2019

What type of PR is this?
/kind feature

What this PR does / why we need it:
This PR introduces internal channels for scheduler with the general idea of phasing out the scheduler util package. The error channels for scheduler must be internal and should not be accessible to other components.
Which issue(s) this PR fixes:

Fixes #84338

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 do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. 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. 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 Oct 25, 2019
@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/feature Categorizes issue or PR as related to a new feature. 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. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Oct 25, 2019
Copy link
Contributor

@draveness draveness left a comment

Choose a reason for hiding this comment

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

/remove-kind feature
/kind cleanup

/lgtm

@k8s-ci-robot k8s-ci-robot added 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. and removed kind/feature Categorizes issue or PR as related to a new feature. labels Oct 25, 2019
@draveness
Copy link
Contributor

/lgtm cancel

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 25, 2019
@hprateek43 hprateek43 force-pushed the error_channel_cleanup branch 2 times, most recently from 1a50b5f to e037f0f Compare October 26, 2019 05:03
@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. sig/apps Categorizes an issue or PR as relevant to SIG Apps. labels Oct 26, 2019
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 26, 2019
@hprateek43
Copy link
Contributor Author

/test pull-kubernetes-kubemark-e2e-gce-big

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 7, 2019
@ahg-g
Copy link
Member

ahg-g commented Nov 7, 2019

can you please rebase and resolve the conflicts?

@hprateek43
Copy link
Contributor Author

hprateek43 commented Nov 10, 2019

can you please rebase and resolve the conflicts?

I just rebased. Had to upgrade go to 1.13 to do so. But now it seems some of the scripts in the hack folder are not working. Could not get hack/update-bazel.sh to run. Also make update changes a lot of go.mod files which is strange.

@ahg-g
Copy link
Member

ahg-g commented Nov 10, 2019

/retest
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahg-g, deads2k, hprateek43

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 10, 2019
@alculquicondor
Copy link
Member

alculquicondor commented Nov 11, 2019

I just rebased. Had to upgrade go to 1.13 to do so. But now it seems some of the scripts in the hack folder are not working. Could not get hack/update-bazel.sh to run. Also make update changes a lot of go.mod files which is strange.

Any specific errors? This can't merge otherwise.

@hprateek43
Copy link
Contributor Author

I just rebased. Had to upgrade go to 1.13 to do so. But now it seems some of the scripts in the hack folder are not working. Could not get hack/update-bazel.sh to run. Also make update changes a lot of go.mod files which is strange.

Any specific errors? This can't merge otherwise.

I had a discussion with @liggitt around this. I just setup my source code inside GOPATH, but am still struggling to get the bazel update running. Will update this in a day or two. Working on that.

@hprateek43
Copy link
Contributor Author

@alculquicondor Seems sorted for now. Should be clear for merge?

@@ -261,6 +261,8 @@
"k8s.io/kubernetes/pkg/capabilities",
"k8s.io/kubernetes/pkg/master/ports",
"k8s.io/kubernetes/pkg/scheduler/api",
"k8s.io/kubernetes/pkg/scheduler/internal",
"k8s.io/kubernetes/pkg/scheduler/internal/errchannel",
Copy link
Member

Choose a reason for hiding this comment

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

we don't want controllers depending on internal scheduler packages, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Eventually we dont. I plan to remove this coupling in the coming weeks, the code can be refactored to remove this dependency. This is added for now for the scheduler cleanup. Can be marked as a TODO.

Copy link
Member

Choose a reason for hiding this comment

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

if this is intended to be a cleanup PR, it would be preferable not to introduce new debt in it. can that dependency be dropped before we mark this internal?

Copy link
Member

Choose a reason for hiding this comment

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

@hprateek43, how do you plan to remove the dependency?

Other than that, I don't understand why import-restrictions apply to indirect imports. I feel like it shouldn't.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the idea is to first eliminate the utils package and then refactor predicates to remove dependencies on internal packages. But @alculquicondor is also right in his place that transient dependencies should not be considered.

Choose a reason for hiding this comment

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

Just as a reminder, .import-restrictions is a home-grown k8s utility that requires us to whitelist all transitive dependencies. The go compiler prevents pkg/controller from directly importing anything in pkg/scheduler/internal/...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@liggitt This point could be considered. Although now I am planning to remove the error channel altogether

Copy link
Member

Choose a reason for hiding this comment

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

@liggitt This point could be considered

that's a good point, and would remove my objection

Although now I am planning to remove the error channel altogether

that sounds even better :)

@hprateek43 hprateek43 force-pushed the error_channel_cleanup branch 4 times, most recently from 2a41943 to 7521123 Compare November 15, 2019 07:40
@hprateek43
Copy link
Contributor Author

/test pull-kubernetes-node-e2e-containerd

1 similar comment
@hprateek43
Copy link
Contributor Author

/test pull-kubernetes-node-e2e-containerd

@hprateek43
Copy link
Contributor Author

@liggitt can you give a lgtm ?

@alculquicondor
Copy link
Member

/hold
for @liggitt's comments

@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 15, 2019
@hprateek43
Copy link
Contributor Author

@misterikkit Can you share your input here? We had a discussion over transitive dependencies over https://github.com/kubernetes/kubernetes/pull/76990/files where you stated that this is more of a quirk of the tool? Do you think this change seems logically correct or we should probably refactor it in a better way ?

@hprateek43
Copy link
Contributor Author

Closing this PR as consensus is not formed regarding internal channels

@hprateek43 hprateek43 closed this Nov 27, 2019
@misterikkit
Copy link

@misterikkit Can you share your input here?

Sorry I just noticed this. My opinion is that the ErrorChannel utility is providing close to zero value, and we could remove some of this dependency mess by just deleting it.

At its core, it is just a wrapper for non-blocking reads and writes on a channel. Adding some select statements to the codebase is not horrible, and if we don't like doing that, having much smaller helper functions just to wrap a select is fine to copy-paste into the packages that need it.

The part where we pass a cancel function into ErrorChannel just so it can call that for us is not doing anything. The caller needs to decide whether to pass that in, so the caller can decide to call cancel instead.

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. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. kind/feature Categorizes issue or PR as related to a new feature. 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/apps Categorizes an issue or PR as relevant to SIG Apps. 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.

Introduce Internal Channels for scheduler
8 participants