Skip to content

Commit

Permalink
nodeselector for each task
Browse files Browse the repository at this point in the history
  • Loading branch information
NikeNano committed Mar 26, 2020
1 parent b82fef4 commit dbca76b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/apis/pipeline/v1alpha1/pipeline_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ type PipelineTask struct {
// Refer Go's ParseDuration documentation for expected format: https://golang.org/pkg/time/#ParseDuration
// +optional
Timeout *metav1.Duration `json:"timeout,omitempty"`

// Set the NodeSelector on PipelineTask level to allow
// for different NodeSelectors for different steps.
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
}

func (pt PipelineTask) HashKey() string {
Expand Down
4 changes: 4 additions & 0 deletions pkg/reconciler/pipelinerun/pipelinerun.go
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,10 @@ func (c *Reconciler) createTaskRun(rprt *resources.ResolvedPipelineRunTask, pr *
PodTemplate: pr.Spec.PodTemplate,
}}

if len(rprt.PipelineTask.NodeSelector) > 0 {
tr.Spec.PodTemplate.NodeSelector = rprt.PipelineTask.NodeSelector
}

if rprt.ResolvedTaskResources.TaskName != "" {
tr.Spec.TaskRef = &v1alpha1.TaskRef{
Name: rprt.ResolvedTaskResources.TaskName,
Expand Down

0 comments on commit dbca76b

Please sign in to comment.