Skip to content

Commit

Permalink
Update Docs for SchedulerName in PodTemplate
Browse files Browse the repository at this point in the history
  • Loading branch information
waveywaves authored and tekton-robot committed Feb 18, 2020
1 parent 689e1b7 commit bf1f620
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
4 changes: 4 additions & 0 deletions docs/podtemplates.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ The current fields supported are:
[priority class](https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/)
to use when running the pod. Use this, for example, to selectively enable
preemption on lower priority workloads.
- `schedulerName` the name of the [scheduler](https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/)
to use when dispatching the Pod. This can be used when workloads of specific types need specific schedulers,
eg: If you are using volcano.sh for Machine Learning Workloads, you can pass the schedulerName and have Tasks be
dispatched by the volcano.sh scheduler.


A pod template can be specified for `TaskRun` or `PipelineRun` resources.
Expand Down
4 changes: 3 additions & 1 deletion docs/taskruns.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ allows to customize some Pod specific field per `Task` execution, aka `TaskRun`.

In the following example, the Task is defined with a `volumeMount`
(`my-cache`), that is provided by the TaskRun, using a
PersistenceVolumeClaim. The Pod will also run as a non-root user.
PersistenceVolumeClaim. The SchedulerName has also been provided to define which scheduler should be used to
dispatch the Pod. The Pod will also run as a non-root user.

```yaml
apiVersion: tekton.dev/v1alpha1
Expand All @@ -216,6 +217,7 @@ spec:
taskRef:
name: mytask
podTemplate:
schedulerName: volcano
securityContext:
runAsNonRoot: true
volumes:
Expand Down
29 changes: 19 additions & 10 deletions pkg/pod/pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -676,14 +676,20 @@ script-heredoc-randomly-generated-78c5n
}, {
desc: "using another scheduler",
ts: v1alpha1.TaskSpec{
Steps: []v1alpha1.Step{{Container: corev1.Container{
Name: "schedule-me",
Image: "image",
Command: []string{"cmd"}, // avoid entrypoint lookup.
}}},
TaskSpec: v1alpha2.TaskSpec{
Steps: []v1alpha1.Step{
{
Container: corev1.Container{
Name: "schedule-me",
Image: "image",
Command: []string{"cmd"}, // avoid entrypoint lookup.
},
},
},
},
},
trs: v1alpha1.TaskRunSpec{
PodTemplate: v1alpha1.PodTemplate{
PodTemplate: &v1alpha1.PodTemplate{
SchedulerName: "there-scheduler",
},
},
Expand All @@ -702,14 +708,17 @@ script-heredoc-randomly-generated-78c5n
"-wait_file_content",
"-post_file",
"/tekton/tools/0",
"-termination_path",
"/tekton/termination",
"-entrypoint",
"cmd",
"--",
},
Env: implicitEnvVars,
VolumeMounts: append([]corev1.VolumeMount{toolsMount, downwardMount}, implicitVolumeMounts...),
WorkingDir: pipeline.WorkspaceDir,
Resources: corev1.ResourceRequirements{Requests: allZeroQty()},
Env: implicitEnvVars,
VolumeMounts: append([]corev1.VolumeMount{toolsMount, downwardMount}, implicitVolumeMounts...),
WorkingDir: pipeline.WorkspaceDir,
Resources: corev1.ResourceRequirements{Requests: allZeroQty()},
TerminationMessagePath: "/tekton/termination",
}},
},
}} {
Expand Down

0 comments on commit bf1f620

Please sign in to comment.