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

Move Taint/Toleration helpers to component-helpers repo #98445

Merged

Conversation

damemi
Copy link
Contributor

@damemi damemi commented Jan 26, 2021

What type of PR is this?
/kind cleanup

What this PR does / why we need it:
This is part of the goal for scheduling to remove dependencies on internal
packages for the scheduling framework. It also provides these functions in an
external location for other components and projects to import.

Which issue(s) this PR fixes:
Ref #89930 and #91782

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


/sig scheduling

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. 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. labels Jan 26, 2021
@k8s-ci-robot
Copy link
Contributor

@damemi: This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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.

@k8s-ci-robot k8s-ci-robot added the needs-priority Indicates a PR lacks a `priority/foo` label and requires one. label Jan 26, 2021
@k8s-ci-robot k8s-ci-robot added area/kubelet area/test sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/node Categorizes an issue or PR as relevant to SIG Node. sig/testing Categorizes an issue or PR as relevant to SIG Testing. labels Jan 26, 2021
Copy link
Contributor Author

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

// TolerationsTolerateTaintsWithFilter checks if given tolerations tolerates
// all the taints that apply to the filter in given taint list.
// DEPRECATED: Please use FindMatchingUntoleratedTaint instead.
func TolerationsTolerateTaintsWithFilter(tolerations []v1.Toleration, taints []v1.Taint, applyFilter taintsFilterFunc) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

Time to drop it given it's deprecated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I thought about that. Updated with it in a new commit

@damemi damemi force-pushed the taint-toleration-internal-helpers branch 2 times, most recently from b436767 to d402165 Compare January 28, 2021 15:50
@damemi
Copy link
Contributor Author

damemi commented Jan 28, 2021

/retest

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 30, 2021
@damemi damemi force-pushed the taint-toleration-internal-helpers branch from d402165 to 80182aa Compare February 1, 2021 15:12
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 1, 2021
@damemi damemi force-pushed the taint-toleration-internal-helpers branch from 80182aa to eec5175 Compare February 1, 2021 15:13
@damemi
Copy link
Contributor Author

damemi commented Feb 1, 2021

rebased
/cc @lavalamp
please take a look for API review, thanks!

@k8s-ci-robot k8s-ci-robot requested review from lavalamp and removed request for gmarek February 1, 2021 15:15
@damemi damemi force-pushed the taint-toleration-internal-helpers branch from eec5175 to b5d0ff3 Compare February 1, 2021 15:24
This is part of the goal for scheduling to remove dependencies on internal
packages for the scheduling framework. It also provides these functions in an
external location for other components and projects to import.
@damemi damemi force-pushed the taint-toleration-internal-helpers branch from b5d0ff3 to 578ff3e Compare February 1, 2021 16:06
@damemi
Copy link
Contributor Author

damemi commented Feb 1, 2021

/retest

@lavalamp
Copy link
Member

lavalamp commented Feb 1, 2021

/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 Feb 1, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: damemi, lavalamp

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 Feb 1, 2021
@k8s-ci-robot
Copy link
Contributor

@damemi: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
pull-kubernetes-e2e-kind-ipv6 578ff3e link /test pull-kubernetes-e2e-kind-ipv6

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@k8s-ci-robot k8s-ci-robot merged commit f27318c into kubernetes:master Feb 2, 2021
SIG Node CI/Test Board automation moved this from Triage to Done Feb 2, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.21 milestone Feb 2, 2021
@Huang-Wei
Copy link
Member

This seems to be cause regression in scheduler perf integration test:

F0202 23:48:44.559482 3887158 perf_utils.go:104] Error listing nodes: there are currently no ready, schedulable nodes in the cluster
goroutine 92 [running]:
k8s.io/kubernetes/vendor/k8s.io/klog/v2.stacks(0xc000a7b001, 0xc004d62000, 0x85, 0x14d)
        /root/go/src/k8s.io/kubernetes/_output/local/go/src/k8s.io/kubernetes/vendor/k8s.io/klog/v2/klog.go:1026 +0xb9
k8s.io/kubernetes/vendor/k8s.io/klog/v2.(*loggingT).output(0x71fffc0, 0xc000000003, 0x0, 0x0, 0xc001c7a7e0, 0x70b6404, 0xd, 0x68, 0x0)
        /root/go/src/k8s.io/kubernetes/_output/local/go/src/k8s.io/kubernetes/vendor/k8s.io/klog/v2/klog.go:975 +0x19b
k8s.io/kubernetes/vendor/k8s.io/klog/v2.(*loggingT).printf(0x71fffc0, 0xc000000003, 0x0, 0x0, 0x0, 0x0, 0x48e4cbb, 0x17, 0xc0077c3770, 0x1, ...)
        /root/go/src/k8s.io/kubernetes/_output/local/go/src/k8s.io/kubernetes/vendor/k8s.io/klog/v2/klog.go:750 +0x191
k8s.io/kubernetes/vendor/k8s.io/klog/v2.Fatalf(...)
        /root/go/src/k8s.io/kubernetes/_output/local/go/src/k8s.io/kubernetes/vendor/k8s.io/klog/v2/klog.go:1514
k8s.io/kubernetes/test/integration/framework.(*IntegrationTestNodePreparer).PrepareNodes(0xc005f56940, 0x0, 0xc005f0d770, 0x5172660)
        /root/go/src/k8s.io/kubernetes/_output/local/go/src/k8s.io/kubernetes/test/integration/framework/perf_utils.go:104 +0xa26
k8s.io/kubernetes/test/integration/scheduler_perf.runWorkload(0xc0000f5680, 0xc000112b40, 0xc000200d00, 0x0, 0x0, 0x0)
        /root/go/src/k8s.io/kubernetes/_output/local/go/src/k8s.io/kubernetes/test/integration/scheduler_perf/scheduler_perf_test.go:337 +0x121d
k8s.io/kubernetes/test/integration/scheduler_perf.BenchmarkPerfScheduling.func1.1(0xc0000f5680)
        /root/go/src/k8s.io/kubernetes/_output/local/go/src/k8s.io/kubernetes/test/integration/scheduler_perf/scheduler_perf_test.go:299 +0x16a
testing.(*B).runN(0xc0000f5680, 0x1)
        /usr/local/go/src/testing/benchmark.go:191 +0xeb
testing.(*B).run1.func1(0xc0000f5680)
        /usr/local/go/src/testing/benchmark.go:231 +0x57
created by testing.(*B).run1
        /usr/local/go/src/testing/benchmark.go:224 +0x7f

// all the filtered taints, and returns the first taint without a toleration
// Returns true if there is an untolerated taint
// Returns false if all taints are tolerated
func FindMatchingUntoleratedTaint(taints []v1.Taint, tolerations []v1.Toleration, inclusionFilter taintsFilterFunc) (v1.Taint, bool) {
Copy link
Member

Choose a reason for hiding this comment

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

A function that returns a negated boolean (Untolerated) is going to cause problems (it already did #98703), and we better fix it before the release is cut. The problem is that you would usually run into situation where you have to say !untolerated, which is a double negation.

In this case, it would be simpler to make this function just return a pointer. And perhaps we can have another exported function that uses this and returns true or false, where true means that it passes all taints.

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 problem is that the deprecated function TolerationsTolerateTaintsWithFilter which we removed had the opposite behavior (returned true if all the taints were tolerated). So this should only affect people who were using the deprecated function, where we had to update their semantics (which caused the regression).

On its own, I don't think this function is too confusing. It's searching for Untolerated Taints, returning true if there are any. But if it would be clearer for some use cases to wrap this and negate it to search for Tolerated Taints, returning true if all are tolerated then that's fine.

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/kubelet 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. needs-triage Indicates an issue or PR lacks a `triage/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/node Categorizes an issue or PR as relevant to SIG Node. 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
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

7 participants