Skip to content

Commit b085abf

Browse files
committed
Add podTemplate on Tasks
1 parent f666d99 commit b085abf

File tree

8 files changed

+1715
-8
lines changed

8 files changed

+1715
-8
lines changed

config/300-crds/300-task.yaml

Lines changed: 679 additions & 0 deletions
Large diffs are not rendered by default.

config/300-crds/300-taskrun.yaml

Lines changed: 679 additions & 0 deletions
Large diffs are not rendered by default.

pkg/apis/pipeline/v1/openapi_generated.go

Lines changed: 14 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/pipeline/v1/swagger.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,10 @@
284284
},
285285
"x-kubernetes-list-type": "atomic"
286286
},
287+
"podTemplate": {
288+
"description": "PodTemplate holds pod specific configuration",
289+
"$ref": "#/definitions/pod.Template"
290+
},
287291
"results": {
288292
"description": "Results are values that this Task can output",
289293
"type": "array",
@@ -2348,6 +2352,10 @@
23482352
},
23492353
"x-kubernetes-list-type": "atomic"
23502354
},
2355+
"podTemplate": {
2356+
"description": "PodTemplate holds pod specific configuration",
2357+
"$ref": "#/definitions/pod.Template"
2358+
},
23512359
"results": {
23522360
"description": "Results are values that this Task can output",
23532361
"type": "array",

pkg/apis/pipeline/v1/task_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package v1
1919
import (
2020
"github.com/tektoncd/pipeline/pkg/apis/pipeline"
2121
"github.com/tektoncd/pipeline/pkg/apis/pipeline/internal/checksum"
22+
"github.com/tektoncd/pipeline/pkg/apis/pipeline/pod"
2223
corev1 "k8s.io/api/core/v1"
2324
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2425
"k8s.io/apimachinery/pkg/runtime/schema"
@@ -122,6 +123,9 @@ type TaskSpec struct {
122123
// Results are values that this Task can output
123124
// +listType=atomic
124125
Results []TaskResult `json:"results,omitempty"`
126+
127+
// PodTemplate holds pod specific configuration
128+
PodTemplate *pod.PodTemplate `json:"podTemplate,omitempty"`
125129
}
126130

127131
// TaskList contains a list of Task

pkg/apis/pipeline/v1/zz_generated.deepcopy.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/pod/pod.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,11 +241,11 @@ func (b *Builder) Build(ctx context.Context, taskRun *v1.TaskRun, taskSpec v1.Ta
241241
initContainers = append(initContainers, *workingDirInit)
242242
}
243243

244-
// By default, use an empty pod template and take the one defined in the task run spec if any
244+
// By default, use an empty pod template and take the merged values of the taskRun/taskSpec specs, if they are defined.
245245
podTemplate := pod.Template{}
246246

247-
if taskRun.Spec.PodTemplate != nil {
248-
podTemplate = *taskRun.Spec.PodTemplate
247+
if taskRun.Spec.PodTemplate != nil || taskSpec.PodTemplate != nil {
248+
podTemplate = *pod.MergePodTemplateWithDefault(taskRun.Spec.PodTemplate, taskSpec.PodTemplate)
249249
}
250250

251251
// Resolve entrypoint for any steps that don't specify command.

0 commit comments

Comments
 (0)