diff --git a/api/openapi-spec/swagger.json b/api/openapi-spec/swagger.json index 023aec707924..315fd5854db7 100644 --- a/api/openapi-spec/swagger.json +++ b/api/openapi-spec/swagger.json @@ -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" @@ -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" diff --git a/pkg/apis/workflow/v1alpha1/openapi_generated.go b/pkg/apis/workflow/v1alpha1/openapi_generated.go index 47392e025d05..3094ace5b6ab 100644 --- a/pkg/apis/workflow/v1alpha1/openapi_generated.go +++ b/pkg/apis/workflow/v1alpha1/openapi_generated.go @@ -1821,6 +1821,13 @@ func schema_pkg_apis_workflow_v1alpha1_Template(ref common.ReferenceCallback) co }, }, }, + "schedulerName": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, }, Required: []string{"name"}, }, @@ -2128,6 +2135,13 @@ func schema_pkg_apis_workflow_v1alpha1_WorkflowSpec(ref common.ReferenceCallback Format: "int32", }, }, + "schedulerName": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, }, Required: []string{"templates", "entrypoint"}, }, diff --git a/pkg/apis/workflow/v1alpha1/types.go b/pkg/apis/workflow/v1alpha1/types.go index 02d9ea9067ab..1874f7211280 100644 --- a/pkg/apis/workflow/v1alpha1/types.go +++ b/pkg/apis/workflow/v1alpha1/types.go @@ -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 @@ -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 diff --git a/workflow/controller/workflowpod.go b/workflow/controller/workflowpod.go index b205c515b168..5b416fa42fb0 100644 --- a/workflow/controller/workflowpod.go +++ b/workflow/controller/workflowpod.go @@ -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