Skip to content

Scheduler: remove direct import to /pkg/features #90111

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

Closed
wants to merge 1 commit into from

Conversation

gavinfish
Copy link
Contributor

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Scheduler: remove direct import to /pkg/features

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/L Denotes a PR that changes 100-499 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 13, 2020
@k8s-ci-robot k8s-ci-robot requested review from ahg-g and wgliang April 13, 2020 13:58
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: gavinfish
To complete the pull request process, please assign alculquicondor
You can assign the PR to them by writing /assign @alculquicondor in a comment when ready.

The full list of commands accepted by this bot can be found 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 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 13, 2020
@gavinfish
Copy link
Contributor Author

/assign @alculquicondor


import "k8s.io/component-base/featuregate"

// NOTE: constants in this file are copied from pkg/features package to avoid external scheduler dependency
Copy link
Member

Choose a reason for hiding this comment

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

scoping feature gates per component seems like a natural progression.
during this process there is the potential for default state of FGs (enabled for >= beta) to drift between the core (pkg/features) and the component that forked the FG. interesting how do you plan to handle that?

@kubernetes/sig-architecture-pr-reviews

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure what is the common practices for other components. I think the worst situation may be synchronizing it before each release?

Copy link
Member

@neolit123 neolit123 Apr 14, 2020

Choose a reason for hiding this comment

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

from my perspective, FGs that target a single component should only be known by this component instead of residing in a shared pool.

on the other hand feature gates that apply to multiple components may have a separate lifecycle. so SomeFeatureGate can be Alpha in the ComponentA and Beta at ComponentB. if SomeFeatureGate graduates to Beta in both that's great. but maybe the overall feature should be considered the lowest version between ComponentA-B.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think that replicating these definitions is a good idea. All but two of these apply to multiple components and their definitions will drift.

if SomeFeatureGate graduates to Beta in both that's great. but maybe the overall feature should be considered the lowest version between ComponentA-B.

that's really confusing for a cluster admin... if there are different aspects that need enabling differently per component, those are probably distinct gates (xref EndpointSlice and EndpointSliceProxying)

An alternative to the scheduler using a global feature map would be to inject the feature states depended on by the scheduler in the scheduler.New() call, so only the cmd/kube-scheduler/app package would depend on the feature gates

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only BalanceAttachedNodeVolumes and ResourceLimitsPriorityFunction(one IT also depends on this) FGs are only used in scheduler.

/cc @Huang-Wei @damemi @ahg-g @alculquicondor WDYT about handling FG in staging scheduler?

Copy link
Member

Choose a reason for hiding this comment

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

I also think this is a bad idea. Feature Gates have always been k8s-wide. So it's not a pattern that can be changed lightly.
Certainly, there are features that involve a number of components and features that don't. But we still release all k8s binaries together, so it doesn't make much sense to treat them separately at this point.
Maybe FG should be part of k8s.io/component-base instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have created an issue to track this at #90136.

@k8s-ci-robot k8s-ci-robot added the sig/architecture Categorizes an issue or PR as relevant to SIG Architecture. label Apr 13, 2020
@@ -279,7 +279,7 @@ func New(client clientset.Interface,
bindTimeoutSeconds: options.bindTimeoutSeconds,
podInitialBackoffSeconds: options.podInitialBackoffSeconds,
podMaxBackoffSeconds: options.podMaxBackoffSeconds,
enableNonPreempting: utilfeature.DefaultFeatureGate.Enabled(kubefeatures.NonPreemptingPriority),
enableNonPreempting: utilfeature.DefaultFeatureGate.Enabled(schedutil.NonPreemptingPriority),
Copy link
Member

Choose a reason for hiding this comment

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

instead of importing utilfeature "k8s.io/apiserver/pkg/util/feature" which contains this:
https://github.com/kubernetes/apiserver/blob/master/pkg/util/feature/feature_gate.go

individual components should just define their local "DefaultFeatureGate"

Copy link
Contributor Author

@gavinfish gavinfish Apr 14, 2020

Choose a reason for hiding this comment

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

This PR is only for /pkg/features, so I will make another PR to take care of /pkg/util/feature.

@k8s-ci-robot
Copy link
Contributor

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

Test name Commit Details Rerun command
pull-kubernetes-e2e-kind-ipv6 306749f link /test pull-kubernetes-e2e-kind-ipv6
pull-kubernetes-e2e-gce 306749f link /test pull-kubernetes-e2e-gce
pull-kubernetes-verify 306749f link /test pull-kubernetes-verify

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.

@k8s-ci-robot
Copy link
Contributor

@gavinfish: PR needs rebase.

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-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 24, 2020
@alculquicondor
Copy link
Member

/hold

@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 Apr 28, 2020
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 27, 2020
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 26, 2020
@k8s-ci-robot k8s-ci-robot added the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Aug 26, 2020
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closed this PR.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note-none Denotes a PR that doesn't merit a release note. sig/architecture Categorizes an issue or PR as relevant to SIG Architecture. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. 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.

6 participants