Skip to content
This repository has been archived by the owner on May 25, 2023. It is now read-only.

Enable PDB based gang scheduling with discrete queues. #465

Merged
merged 6 commits into from
Nov 7, 2018

Conversation

adam-marek
Copy link
Contributor

What this PR does / why we need it:
Currently it's not possible to schedule PDB based gangs when the enable-namespace-as-queue option is disabled. This PR introduces an option to set the name of the queue to be used with PDB based jobs via the command line (if not specified the name of the namespace is still used).
Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:

Release note:

It's now possible to scheduled PDB based jobs while the `enable-namespace-as-queue` option is set to `false`. The new `pdb-queue` command line option allows to manually select the queue to be used for PDB based jobs in such cases.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 5, 2018
@@ -49,6 +61,7 @@ func (s *ServerOption) AddFlags(fs *pflag.FlagSet) {
fs.StringVar(&s.SchedulerName, "scheduler-name", "kube-batch", "kube-batch will handle pods with the scheduler-name")
fs.StringVar(&s.SchedulerConf, "scheduler-conf", "", "The namespace and name of ConfigMap for scheduler configuration")
fs.StringVar(&s.SchedulePeriod, "schedule-period", "1s", "The period between each scheduling cycle")
fs.StringVar(&s.PdbQueue, "pdb-queue", "", "The name of the Queue object to be used with PDBs instead of their namespace name")
Copy link
Contributor

Choose a reason for hiding this comment

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

Comparing to add a parameter, prefer to add an annotation to PDB for queue.

Copy link
Contributor

Choose a reason for hiding this comment

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

for example scheduling.k8s.io/queue-name

Copy link
Contributor

@k82cn k82cn Nov 6, 2018

Choose a reason for hiding this comment

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

with annotation, you can create more queues for different PDBs :)

Copy link
Contributor Author

@adam-marek adam-marek Nov 6, 2018

Choose a reason for hiding this comment

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

The specific use case I'm looking at is co-scheduling tf-operator jobs with other multi-node workloads (PodGroup/Queue based). Fully agree that annotations are more flexible, however if we go that route then tf-operator needs to be extended to add said annotations to its PDBs (either directly or via a mutating admission controller) which is problematic for existing deployments.

So we could consider this PR as a stop gap for environments where PDBs cannot be easily equipped with additional annotations (for whatever reason).

Separately the longer term strategy should be decided: either introduce the annotations and extend the tf-operator's PDBs to include them or switch the latter to PodGroups entirely (since with annotations we would introduce kube-batch specific concepts anyway)?

Copy link
Contributor

Choose a reason for hiding this comment

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

oh, for tf-operator case, I'd like to switch it to PodGroups; but we need to align with tf-operator team and sig-scheduling for it. How about open an issue in kubeflow/tf-operator for it firstly?

Copy link
Contributor

Choose a reason for hiding this comment

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

btw, you did not use multiple queues, 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.

no - my use case is based on a single queue

and I agree that switching to PodGroups is the way to go for tf-operator and I can definitely open an issue there, however the way things stand currently, tf-operator gang scheduling doesn't work if queue as namespace is disabled.

Copy link
Contributor

Choose a reason for hiding this comment

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

if we switch to PodGroup, we still need to provide default queue name for your case (similar to this PR); otherwise, tf-operator need to have a field for Queue.

Queue is an experimental feature right now, which means you can have a try, but other community should not dependent on it.

Because of above reasons, maybe your PR is better as a temp solution; WDYT?

Copy link
Contributor

@k82cn k82cn Nov 6, 2018

Choose a reason for hiding this comment

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

BTW, prefer DefaultQueue instead of PdbQueue; so when we remove PDB, it also works for PodGroup.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

makes sense, will amend

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 6, 2018
@k82cn
Copy link
Contributor

k82cn commented Nov 7, 2018

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 7, 2018
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: adam-marek, k82cn

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 7, 2018
@k8s-ci-robot k8s-ci-robot merged commit 6a334ee into kubernetes-retired:master Nov 7, 2018
@k82cn k82cn mentioned this pull request Nov 23, 2018
kevin-wangzefeng pushed a commit to kevin-wangzefeng/scheduler that referenced this pull request Jun 28, 2019
…queue

Enable PDB based gang scheduling with discrete queues.
kevin-wangzefeng pushed a commit to kevin-wangzefeng/scheduler that referenced this pull request Jun 28, 2019
…queue

Enable PDB based gang scheduling with discrete queues.
kevin-wangzefeng pushed a commit to kevin-wangzefeng/scheduler that referenced this pull request Jun 28, 2019
…queue

Enable PDB based gang scheduling with discrete queues.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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. lgtm Indicates that a PR is ready to be merged. 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.

3 participants