Skip to content

Commit fba036a

Browse files
committed
Add SecurityContext to TaskSpec
1 parent 9428c43 commit fba036a

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

docs/tasks.md

+3
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ following fields:
7373
by your `Task`
7474
- [`volumes`](#volumes) - Specifies one or more volumes that you want to make
7575
available to your build.
76+
- [`securityContext`] - SecurityContext holds pod-level security attributes and
77+
common container settings. Defaults to empty. See type description for default
78+
values of each field.
7679

7780
[kubernetes-overview]:
7881
https://kubernetes.io/docs/concepts/overview/working-with-objects/kubernetes-objects/#required-fields

pkg/apis/pipeline/v1alpha1/task_types.go

+4
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ type TaskSpec struct {
4949
// Volumes is a collection of volumes that are available to mount into the
5050
// steps of the build.
5151
Volumes []corev1.Volume `json:"volumes,omitempty"`
52+
// SecurityContext holds pod-level security attributes and common container settings.
53+
// Optional: Defaults to empty. See type description for default values of each field.
54+
// +optional
55+
SecurityContext *corev1.PodSecurityContext `json:"securityContext,omitempty"`
5256
}
5357

5458
// Check that Task may be validated and defaulted.

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

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/reconciler/v1alpha1/taskrun/resources/pod.go

+1
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ func MakePod(taskRun *v1alpha1.TaskRun, taskSpec v1alpha1.TaskSpec, kubeclient k
246246
Containers: podContainers,
247247
ServiceAccountName: taskRun.Spec.ServiceAccount,
248248
Volumes: volumes,
249+
SecurityContext: taskSpec.SecurityContext,
249250
NodeSelector: taskRun.Spec.NodeSelector,
250251
Affinity: taskRun.Spec.Affinity,
251252
},

0 commit comments

Comments
 (0)