Skip to content

Commit

Permalink
Add SecurityContext to TaskSpec
Browse files Browse the repository at this point in the history
  • Loading branch information
dicarlo2 committed Apr 3, 2019
1 parent 9428c43 commit fba036a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ following fields:
by your `Task`
- [`volumes`](#volumes) - Specifies one or more volumes that you want to make
available to your build.
- [`securityContext`] - SecurityContext holds pod-level security attributes and
common container settings. Defaults to empty. See type description for default
values of each field.

[kubernetes-overview]:
https://kubernetes.io/docs/concepts/overview/working-with-objects/kubernetes-objects/#required-fields
Expand Down
4 changes: 4 additions & 0 deletions pkg/apis/pipeline/v1alpha1/task_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ type TaskSpec struct {
// Volumes is a collection of volumes that are available to mount into the
// steps of the build.
Volumes []corev1.Volume `json:"volumes,omitempty"`
// SecurityContext holds pod-level security attributes and common container settings.
// Optional: Defaults to empty. See type description for default values of each field.
// +optional
SecurityContext *corev1.PodSecurityContext `json:"securityContext,omitempty"`
}

// Check that Task may be validated and defaulted.
Expand Down
9 changes: 9 additions & 0 deletions pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go

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

1 change: 1 addition & 0 deletions pkg/reconciler/v1alpha1/taskrun/resources/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ func MakePod(taskRun *v1alpha1.TaskRun, taskSpec v1alpha1.TaskSpec, kubeclient k
Containers: podContainers,
ServiceAccountName: taskRun.Spec.ServiceAccount,
Volumes: volumes,
SecurityContext: taskSpec.SecurityContext,
NodeSelector: taskRun.Spec.NodeSelector,
Affinity: taskRun.Spec.Affinity,
},
Expand Down

0 comments on commit fba036a

Please sign in to comment.