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

add non-preempting option to PriorityClasses #74614

Merged
merged 2 commits into from May 31, 2019

Conversation

denkensk
Copy link
Member

@denkensk denkensk commented Feb 26, 2019

What type of PR is this?
/kind feature
/priority important-soon

What this PR does / why we need it:
Adds a NonPrempting field to the PriorityClass. If set on a class, it will continue to be prioritized above queued pods of a lesser class, but will not preempt running pods.

Which issue(s) this PR fixes:
Fixes #67671
kubernetes/enhancements#902

Add  NonPrempting field to the PriorityClass.

@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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. kind/feature Categorizes issue or PR as related to a new feature. 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-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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Feb 26, 2019
@k8s-ci-robot k8s-ci-robot added area/kubectl kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/auth Categorizes an issue or PR as relevant to SIG Auth. sig/cli Categorizes an issue or PR as relevant to SIG CLI. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Feb 26, 2019
@cblecker cblecker removed their request for review February 27, 2019 00:11
@denkensk denkensk force-pushed the no-preempting-priority branch 3 times, most recently from faccb20 to 23151be Compare March 1, 2019 06:52
cmd/kube-scheduler/app/server.go Outdated Show resolved Hide resolved
@@ -42,5 +42,5 @@ func init() {
// We only register manually written functions here. The registration of the
// generated functions takes place in the generated files. The separation
// makes the code compile even when the generated files are missing.
localSchemeBuilder.Register(RegisterDefaults)
localSchemeBuilder.Register(addDefaultingFuncs)
Copy link
Member

Choose a reason for hiding this comment

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

same here, the regitration for defaults should be under v1 ?

@liggitt liggitt removed sig/auth Categorizes an issue or PR as relevant to SIG Auth. labels Mar 6, 2019
@denkensk denkensk changed the title [WIP] No preempting priority [WIP] add non-preempting option to PriorityClasses Mar 21, 2019
@k8s-ci-robot k8s-ci-robot added area/test sig/auth Categorizes an issue or PR as relevant to SIG Auth. labels Mar 28, 2019
@denkensk
Copy link
Member Author

/retest

@@ -41,6 +41,9 @@ func ValidatePriorityClass(pc *scheduling.PriorityClass) field.ErrorList {
// Non-system critical priority classes are not allowed to have a value larger than HighestUserDefinablePriority.
allErrs = append(allErrs, field.Forbidden(field.NewPath("value"), fmt.Sprintf("maximum allowed value of a user defined priority is %v", scheduling.HighestUserDefinablePriority)))
}
if pc.PreemptionPolicy != nil {
allErrs = append(allErrs, apivalidation.ValidatePreemptionPolicy(pc.PreemptionPolicy, field.NewPath("PreemptionPolicy"))...)
Copy link
Member

Choose a reason for hiding this comment

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

"preemptionPolicy", since this is shown to the user and should match the serialized field name

@@ -52,5 +55,7 @@ func ValidatePriorityClassUpdate(pc, oldPc *scheduling.PriorityClass) field.Erro
if pc.Value != oldPc.Value {
allErrs = append(allErrs, field.Forbidden(field.NewPath("Value"), "may not be changed in an update."))
}
// PreemptionPolicy is immutable and is checked by the ObjectMeta validator.
allErrs = append(allErrs, apivalidation.ValidateImmutableField(pc.PreemptionPolicy, oldPc.PreemptionPolicy, field.NewPath("PreemptionPolicy"))...)
Copy link
Member

Choose a reason for hiding this comment

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

"preemptionPolicy", since this is shown to the user and should match the serialized field name


cmd.Flags().Int32("value", 0, i18n.T("the value of this priority class."))
cmd.Flags().Bool("global-default", false, i18n.T("global-default specifies whether this PriorityClass should be considered as the default priority."))
cmd.Flags().String("description", "", i18n.T("description is an arbitrary string that usually provides guidelines on when this priority class should be used."))
cmd.Flags().String("preemption-policy", "PreemptLowerPriority", i18n.T("preemption-policy is the policy for preempting pods with lower priority."))
Copy link
Member

Choose a reason for hiding this comment

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

don't specify a default for alpha fields

@liggitt
Copy link
Member

liggitt commented May 30, 2019

verify test requires single-line invocations of SetFeatureGateDuringTest:

Invalid invocations of featuregatetesting.SetFeatureGateDuringTest():
./pkg/apis/scheduling/v1/defaults_test.go:60:	defer featuregatetesting.SetFeatureGateDuringTest(nil, utilfeature.DefaultFeatureGate,
./pkg/apis/scheduling/v1beta1/defaults_test.go:60:	defer featuregatetesting.SetFeatureGateDuringTest(nil, utilfeature.DefaultFeatureGate,
./pkg/apis/scheduling/v1alpha1/defaults_test.go:60:	defer featuregatetesting.SetFeatureGateDuringTest(nil, utilfeature.DefaultFeatureGate,

Always make a deferred call to the returned function to ensure the feature gate is reset:
  defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.<FeatureName>, <value>)()

@liggitt
Copy link
Member

liggitt commented May 30, 2019

a few last comments and the verify test fixup, then this LGTM. thanks for all the work

@liggitt
Copy link
Member

liggitt commented May 30, 2019

/approve

API changes look good. needs a squash then lgtm

@liggitt liggitt moved this from Changes requested to Completed, 1.15 in API Reviews May 30, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bsalamat, denkensk, liggitt

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 May 30, 2019
@liggitt
Copy link
Member

liggitt commented May 30, 2019

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 30, 2019
@denkensk
Copy link
Member Author

/retest

@denkensk
Copy link
Member Author

/test pull-kubernetes-e2e-gce-100-performance

1 similar comment
@BenTheElder
Copy link
Member

/test pull-kubernetes-e2e-gce-100-performance

denkensk and others added 2 commits May 31, 2019 12:37
Co-authored-by: Vallery Lancey <vallery@zeitgeistlabs.io>
Co-authored-by: Tan shanshan <tan.shanshan@zte.com.cn>
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 31, 2019
@denkensk
Copy link
Member Author

Just rebase in "pkg/features/kube_features.go" @bsalamat @liggitt need lgtm again?

@vllry
Copy link
Contributor

vllry commented May 31, 2019

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 31, 2019
@denkensk
Copy link
Member Author

/retest

@k8s-ci-robot k8s-ci-robot merged commit 6c42729 into kubernetes:master May 31, 2019
@liggitt liggitt removed the sig/auth Categorizes an issue or PR as relevant to SIG Auth. label Feb 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-review Categorizes an issue or PR as actively needing an API review. approved Indicates a PR has been approved by an approver from all required OWNERS files. area/apiserver area/kubectl area/kubelet area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API 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-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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/cli Categorizes an issue or PR as relevant to SIG CLI. 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/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
Status: API review completed, 1.15
Development

Successfully merging this pull request may close these issues.

Non-preempting PriorityClass
10 participants