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 a deprecated cmd flag for the time interval between flushing pods from unschedualbeQ to activeQ or backoffQ. #108017

Merged
merged 1 commit into from
Feb 16, 2022

Conversation

denkensk
Copy link
Member

@denkensk denkensk commented Feb 9, 2022

What type of PR is this?

/kind feature

What this PR does / why we need it:

#87850 (comment)

Which issue(s) this PR fixes:

The first part of #87850

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Add a deprecated cmd flag for the time interval between flushing pods from unschedualbeQ to activeQ or backoffQ.

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

None

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. 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. labels Feb 9, 2022
@k8s-ci-robot
Copy link
Contributor

@denkensk: 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 do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Feb 9, 2022
@k8s-ci-robot k8s-ci-robot added sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Feb 9, 2022
// unschedulableQ. If a pod stays in unschedulableQ for longer than this
// value, the pod will be moved from unschedulableQ to backoffQ or activeQ.
// If this value is empty, the default value (60s) will be used.
PodMaxUnscheduleQDuration metav1.Duration
Copy link
Member

Choose a reason for hiding this comment

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

why not move this to ComponentConfig? There is a similar field there

// PodMaxBackoffSeconds is the max backoff for unschedulable pods.
// If specified, it must be greater than or equal to podInitialBackoffSeconds. If this value is null,
// the default value (10s) will be used.
PodMaxBackoffSeconds int64

Copy link
Member Author

Choose a reason for hiding this comment

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

It is a command line flag with a deprecated notice from the beginning. It will be deleted in the future. So I want to keep it independent of CC.

Copy link
Member

Choose a reason for hiding this comment

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

got it.

@@ -170,6 +175,7 @@ type priorityQueueOptions struct {
clock util.Clock
podInitialBackoffDuration time.Duration
podMaxBackoffDuration time.Duration
podMaxUnscheduleQDuration time.Duration
Copy link
Member

Choose a reason for hiding this comment

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

I think we should rename this to podMaxUnschedulableDuration, to keep the consistent style as above.

Copy link
Member Author

@denkensk denkensk Feb 9, 2022

Choose a reason for hiding this comment

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

Done podMaxUnscheduleQDuration --> podMaxUnschedulableQDuration

@@ -297,6 +297,9 @@ func (o *Options) Config() (*schedulerappconfig.Config, error) {
dynClient := dynamic.NewForConfigOrDie(kubeConfig)
c.DynInformerFactory = dynamicinformer.NewFilteredDynamicSharedInformerFactory(dynClient, 0, corev1.NamespaceAll, nil)
c.LeaderElection = leaderElectionConfig
if o.Deprecated != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we move this to here, as --config not specified.

// ApplyDeprecated obtains the deprecated CLI args and set them to `o.ComponentConfig` if specified.
func (o *Options) ApplyDeprecated() {
if o.Flags == nil {
return
}
// Obtain deprecated CLI args. Set them to cfg if specified in command line.
deprecated := o.Flags.FlagSet("deprecated")
if deprecated.Changed("profiling") {
o.ComponentConfig.EnableProfiling = o.Deprecated.EnableProfiling
}
if deprecated.Changed("contention-profiling") {
o.ComponentConfig.EnableContentionProfiling = o.Deprecated.EnableContentionProfiling
}
if deprecated.Changed("kubeconfig") {
o.ComponentConfig.ClientConnection.Kubeconfig = o.Deprecated.Kubeconfig
}
if deprecated.Changed("kube-api-content-type") {
o.ComponentConfig.ClientConnection.ContentType = o.Deprecated.ContentType
}
if deprecated.Changed("kube-api-qps") {
o.ComponentConfig.ClientConnection.QPS = o.Deprecated.QPS
}
if deprecated.Changed("kube-api-burst") {
o.ComponentConfig.ClientConnection.Burst = o.Deprecated.Burst
}
if deprecated.Changed("lock-object-namespace") {
o.ComponentConfig.LeaderElection.ResourceNamespace = o.Deprecated.ResourceNamespace
}
if deprecated.Changed("lock-object-name") {
o.ComponentConfig.LeaderElection.ResourceName = o.Deprecated.ResourceName
}
}

Copy link
Member Author

Choose a reason for hiding this comment

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

It is just used to set to CC。

@kerthcet
Copy link
Member

kerthcet commented Feb 9, 2022

Hi @denkensk , I commented for several places, but I'm not sure whether I understood your thoughts correctly, so if not, please correct me. Thanks a lot.

@denkensk
Copy link
Member Author

denkensk commented Feb 9, 2022

/retest-required

@denkensk
Copy link
Member Author

/assign @alculquicondor

// unschedulableQ. If a pod stays in unschedulableQ for longer than this
// value, the pod will be moved from unschedulableQ to backoffQ or activeQ.
// If this value is empty, the default value (60s) will be used.
PodMaxUnschedulableQDuration metav1.Duration
Copy link
Member

Choose a reason for hiding this comment

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

you can just use time.Duration, because this is not an API.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@@ -44,4 +52,5 @@ func (o *DeprecatedOptions) AddFlags(fs *pflag.FlagSet) {
fs.Int32Var(&o.Burst, "kube-api-burst", 100, "DEPRECATED: burst to use while talking with kubernetes apiserver. This parameter is ignored if a config file is specified in --config.")
fs.StringVar(&o.ResourceNamespace, "lock-object-namespace", "kube-system", "DEPRECATED: define the namespace of the lock object. Will be removed in favor of leader-elect-resource-namespace. This parameter is ignored if a config file is specified in --config.")
fs.StringVar(&o.ResourceName, "lock-object-name", "kube-scheduler", "DEPRECATED: define the name of the lock object. Will be removed in favor of leader-elect-resource-name. This parameter is ignored if a config file is specified in --config.")
fs.DurationVar(&o.PodMaxUnschedulableQDuration.Duration, "pod-max-unschedulableq-duration", 60*time.Second, "DEPRECATED: the maximum time a pod can stay in unschedulableQ. If a pod stays in unschedulableQ for longer than this value, the pod will be moved from unschedulableQ to backoffQ or activeQ. will be removed once the mechanism for flushing pods from unschedulableQ to backoffQ or activeQ has been removed.")
Copy link
Member

Choose a reason for hiding this comment

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

Let's put an estimate: Will be removed in 1.26.

Avoid talking about internal fields in the user documentation.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated

@@ -231,6 +233,11 @@ func (o *Options) ApplyTo(c *schedulerappconfig.Config) error {
}
}
o.Metrics.Apply()

if o.Deprecated != nil {
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 about why this is not part of ApplyDeprecated.

Presumably because this can't be configured via ComponentConfig.

pkg/scheduler/factory.go Outdated Show resolved Hide resolved
// for longer than this value, the pod will be moved from unschedulableQ to
// backoffQ or activeQ. If this value is empty, the default value (60s)
// will be used.
DefaultPodMaxUnschedulableQDuration time.Duration = 60 * time.Second
Copy link
Member

Choose a reason for hiding this comment

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

We agreed to increase the default. Are you doing that in a separate PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. It is planed to be updated in a separate PR.

pkg/scheduler/internal/queue/scheduling_queue_test.go Outdated Show resolved Hide resolved
pkg/scheduler/scheduler.go Outdated Show resolved Hide resolved
@denkensk
Copy link
Member Author

/test pull-kubernetes-e2e-kind

Copy link
Member

@alculquicondor alculquicondor left a comment

Choose a reason for hiding this comment

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

You can squash

cmd/kube-scheduler/app/options/deprecated.go Outdated Show resolved Hide resolved
@denkensk
Copy link
Member Author

You can squash

Thanks. Squashed. @alculquicondor

@alculquicondor
Copy link
Member

/approve
/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alculquicondor, denkensk

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 16, 2022
@k8s-ci-robot k8s-ci-robot merged commit f538b0b into kubernetes:master Feb 16, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.24 milestone Feb 16, 2022
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. 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. 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 Denotes a PR that will be considered when it comes time to generate release notes. 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.

None yet

4 participants