Skip to content

Commit 27ec1ba

Browse files
authored
Merge pull request #94734 from ochromy/RHDEVDOCS-6461
[RHDEVDOCS-6461] Configuring securityContext in EventListener definition
2 parents 6237269 + 4021115 commit 27ec1ba

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// This module is included in the following assemblies:
2+
// * secure/securing-webhooks-with-event-listeners.adoc
3+
4+
:_mod-docs-content-type: PROCEDURE
5+
[id="op-setting-eventlistener-scc_{context}"]
6+
= Configuring security context for event listeners
7+
8+
You can configure a custom security context directly in your `EventListener` custom resource (CR) to meet your security requirements. A custom security context can help ensure that containers run with restricted privileges and comply with {OCP} security context constraints (SCCs).
9+
10+
.Procedure
11+
12+
* Create a YAML file that defines your `EventListener` CR:
13+
+
14+
.Example EventListener custom resource with configured security context
15+
[source,yaml,subs="attributes+"]
16+
----
17+
apiVersion: triggers.tekton.dev/v1beta1
18+
kind: EventListener
19+
metadata:
20+
#...
21+
spec:
22+
serviceAccountName: tekton-triggers-sa
23+
resources:
24+
kubernetesResource:
25+
spec:
26+
template:
27+
spec:
28+
securityContext:
29+
runAsNonRoot: true <1>
30+
containers:
31+
- resources:
32+
requests:
33+
memory: "64Mi"
34+
cpu: "250m"
35+
limits:
36+
memory: "128Mi"
37+
cpu: "500m"
38+
securityContext:
39+
readOnlyRootFilesystem: true <2>
40+
#...
41+
----
42+
<1> Specify the pod-level security context settings. The example setting sets the pod-level security context to prevent the containers from running as the root user.
43+
<2> Specify the container-level security context settings. The example setting restricts the container root filesystem to read-only to limit potential file system modifications at runtime.

secure/securing-webhooks-with-event-listeners.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,6 @@ In addition, you can mount the created secret into the `Eventlistener` pod to se
2121

2222
include::modules/op-providing-secure-connection.adoc[leveloffset=+1]
2323

24+
include::modules/op-setting-eventlistener-scc.adoc[leveloffset=+1]
25+
2426
include::modules/op-sample-eventlistener-resource.adoc[leveloffset=+1]

0 commit comments

Comments
 (0)