Skip to content

Commit 783c665

Browse files
committed
fix: address review comments
1 parent d94ff0e commit 783c665

File tree

3 files changed

+56
-2
lines changed

3 files changed

+56
-2
lines changed

charts/shield/templates/host/_helpers.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ capabilities:
201201
allowPrivilegeEscalation: false
202202
seccompProfile:
203203
type: Unconfined
204-
{{- if (include "common.cluster_type.is_bottlerocket" .) }}
204+
{{- if and (eq (include "host.response_actions_enabled" .) "true") (include "common.cluster_type.is_bottlerocket" .) }}
205205
seLinuxOptions:
206206
type: control_t
207207
{{- end }}

charts/shield/tests/host/daemonset_test.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ tests:
150150
privileged: false
151151
cluster_config:
152152
cluster_type: bottlerocket
153+
features:
154+
respond:
155+
response_actions:
156+
enabled: true
153157
asserts:
154158
- isSubset:
155159
path: spec.template.spec.containers[?(@.name == "sysdig-host-shield")].securityContext

charts/shield/tests/host/security_context_test.yaml

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,17 @@ tests:
5656
runAsNonRoot: false
5757
runAsUser: 0
5858

59-
- it: Ensure the securityContext for bottlerocket includes seLinuxOptions
59+
- it: Ensure the securityContext for bottlerocket with response_actions includes seLinuxOptions
6060
set:
6161
host:
6262
privileged: false
6363
driver: universal_ebpf
6464
cluster_config:
6565
cluster_type: bottlerocket
66+
features:
67+
respond:
68+
response_actions:
69+
enabled: true
6670
asserts:
6771
- isSubset:
6872
path: spec.template.spec.containers[?(@.name == "sysdig-host-shield")].securityContext
@@ -73,6 +77,52 @@ tests:
7377
seLinuxOptions:
7478
type: control_t
7579

80+
- it: Ensure the securityContext for bottlerocket without response_actions does not include seLinuxOptions
81+
set:
82+
host:
83+
privileged: false
84+
driver: universal_ebpf
85+
cluster_config:
86+
cluster_type: bottlerocket
87+
features:
88+
respond:
89+
response_actions:
90+
enabled: false
91+
asserts:
92+
- isSubset:
93+
path: spec.template.spec.containers[?(@.name == "sysdig-host-shield")].securityContext
94+
content:
95+
allowPrivilegeEscalation: false
96+
seccompProfile:
97+
type: Unconfined
98+
- isNotSubset:
99+
path: spec.template.spec.containers[?(@.name == "sysdig-host-shield")].securityContext
100+
content:
101+
seLinuxOptions:
102+
type: control_t
103+
104+
- it: Ensure the securityContext for non-bottlerocket with response_actions does not include seLinuxOptions
105+
set:
106+
host:
107+
privileged: false
108+
driver: universal_ebpf
109+
features:
110+
respond:
111+
response_actions:
112+
enabled: true
113+
asserts:
114+
- isSubset:
115+
path: spec.template.spec.containers[?(@.name == "sysdig-host-shield")].securityContext
116+
content:
117+
allowPrivilegeEscalation: false
118+
seccompProfile:
119+
type: Unconfined
120+
- isNotSubset:
121+
path: spec.template.spec.containers[?(@.name == "sysdig-host-shield")].securityContext
122+
content:
123+
seLinuxOptions:
124+
type: control_t
125+
76126
- it: Ensure the security_context is honored
77127
set:
78128
host:

0 commit comments

Comments
 (0)