Skip to content

Commit

Permalink
Add schedulerName to workflow and template spec (#1184)
Browse files Browse the repository at this point in the history
  • Loading branch information
houz authored and jessesuen committed Feb 12, 2019
1 parent 2ddae16 commit f1797f7
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
8 changes: 8 additions & 0 deletions api/openapi-spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,10 @@
"description": "RetryStrategy describes how to retry a template when it fails",
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.RetryStrategy"
},
"schedulerName": {
"description": "If specified, the pod will be dispatched by specified scheduler. Or it will be dispatched by workflow scope scheduler if specified. If neither specified, the pod will be dispatched by default scheduler.",
"type": "string"
},
"script": {
"description": "Script runs a portion of code against an interpreter",
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.ScriptTemplate"
Expand Down Expand Up @@ -1123,6 +1127,10 @@
"type": "integer",
"format": "int32"
},
"schedulerName": {
"description": "Set scheduler name for all pods. Will be overridden if container/script template's scheduler name is set. Default scheduler will be used if neither specified.",
"type": "string"
},
"serviceAccountName": {
"description": "ServiceAccountName is the name of the ServiceAccount to run all pods of the workflow as.",
"type": "string"
Expand Down
14 changes: 14 additions & 0 deletions pkg/apis/workflow/v1alpha1/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions pkg/apis/workflow/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@ type WorkflowSpec struct {
ActiveDeadlineSeconds *int64 `json:"activeDeadlineSeconds,omitempty"`
// Priority is used if controller is configured to process limited number of workflows in parallel. Workflows with higher priority are processed first.
Priority *int32 `json:"priority,omitempty"`

// Set scheduler name for all pods.
// Will be overridden if container/script template's scheduler name is set.
// Default scheduler will be used if neither specified.
// +optional
SchedulerName string `json:"schedulerName,omitempty"`
}

// Template is a reusable and composable unit of execution in a workflow
Expand Down Expand Up @@ -217,6 +223,12 @@ type Template struct {

// Tolerations to apply to workflow pods.
Tolerations []apiv1.Toleration `json:"tolerations,omitempty"`

// If specified, the pod will be dispatched by specified scheduler.
// Or it will be dispatched by workflow scope scheduler if specified.
// If neither specified, the pod will be dispatched by default scheduler.
// +optional
SchedulerName string `json:"schedulerName,omitempty"`
}

// Inputs are the mechanism for passing parameters, artifacts, volumes from one template to another
Expand Down
6 changes: 6 additions & 0 deletions workflow/controller/workflowpod.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,12 @@ func addSchedulingConstraints(pod *apiv1.Pod, wfSpec *wfv1.WorkflowSpec, tmpl *w
} else if len(wfSpec.Tolerations) > 0 {
pod.Spec.Tolerations = wfSpec.Tolerations
}
// Set scheduler name (if specified)
if tmpl.SchedulerName != "" {
pod.Spec.SchedulerName = tmpl.SchedulerName
} else if wfSpec.SchedulerName != "" {
pod.Spec.SchedulerName = wfSpec.SchedulerName
}
}

// addVolumeReferences adds any volumeMounts that a container/sidecar is referencing, to the pod.spec.volumes
Expand Down

0 comments on commit f1797f7

Please sign in to comment.