Skip to content

Commit d9cb116

Browse files
chore(agent,sysdig-deploy,shield): add /sys/fs mount (#2223)
Co-authored-by: José Antonio Calvo <[email protected]>
1 parent 85705ea commit d9cb116

File tree

6 files changed

+107
-5
lines changed

6 files changed

+107
-5
lines changed

charts/agent/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ sources:
3030
- https://app.sysdigcloud.com/#/settings/user
3131
- https://github.com/draios/sysdig
3232
type: application
33-
version: 1.36.5
33+
version: 1.36.6

charts/agent/templates/daemonset.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,9 @@ spec:
288288

289289
{{- /* Slim = false, Autopilot = false */}}
290290
{{- if and (not .Values.slim.enabled) (not (include "agent.gke.autopilot" .)) }}
291+
- mountPath: /host/sys/fs
292+
name: sysfs-vol
293+
readOnly: true
291294
- mountPath: /etc/modprobe.d
292295
name: modprobe-d
293296
readOnly: true
@@ -326,6 +329,9 @@ spec:
326329
name: vardata-vol
327330
- mountPath: /host/var/run
328331
name: varrun-vol
332+
- mountPath: /host/sys/fs
333+
name: sysfs-vol
334+
readOnly: true
329335
{{- if (include "agent.ebpfEnabled" .) }}
330336
- mountPath: /root/.sysdig
331337
name: bpf-probes
@@ -431,6 +437,9 @@ spec:
431437

432438
{{- /* Slim = false, Autopilot = false */}}
433439
{{- if and (not .Values.slim.enabled) (not (include "agent.gke.autopilot" .)) }}
440+
- name: sysfs-vol
441+
hostPath:
442+
path: /sys/fs
434443
- name: modprobe-d
435444
hostPath:
436445
path: /etc/modprobe.d
@@ -463,6 +472,9 @@ spec:
463472

464473
{{- /* Slim = true, Autopilot = false */}}
465474
{{- if and (.Values.slim.enabled) (not (include "agent.gke.autopilot" .)) }}
475+
- name: sysfs-vol
476+
hostPath:
477+
path: /sys/fs
466478
- name: modprobe-d
467479
hostPath:
468480
path: /etc/modprobe.d

charts/shield/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ maintainers:
1313
- name: mavimo
1414
1515
type: application
16-
version: 1.3.3
16+
version: 1.3.4
1717
appVersion: "1.0.0"

charts/shield/templates/host/_helpers.tpl

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ true
136136
{{- end }}
137137

138138
{{- define "host.need_host_root" }}
139-
{{- if or .Values.features.posture.host_posture.enabled .Values.features.vulnerability_management.host_vulnerability_management.enabled }}
139+
{{- if or (eq (include "host.response_actions_enabled" .) "true") .Values.features.posture.host_posture.enabled .Values.features.vulnerability_management.host_vulnerability_management.enabled }}
140140
{{- true -}}
141141
{{- end }}
142142
{{- end }}
@@ -214,6 +214,22 @@ true
214214
{{- end }}
215215
{{- end }}
216216

217+
{{/*
218+
This function checks if the response_actions feature is enabled for the host.
219+
It first checks the additional_settings and then the features.
220+
If neither is found, it defaults to false.
221+
*/}}
222+
{{- define "host.response_actions_enabled" }}
223+
{{- $feature_respond := dig (include "host.respond_key" .Values.features) (dict) .Values.features }}
224+
{{- $additional_features := dig "features" (dict) .Values.host.additional_settings }}
225+
{{- $additional_respond := dig (include "host.respond_key" $additional_features) (dict) $additional_features }}
226+
{{- if hasKey $additional_respond "response_actions" }}
227+
{{- dig "response_actions" "enabled" false $additional_respond -}}
228+
{{- else if hasKey $feature_respond "response_actions" }}
229+
{{- dig "response_actions" "enabled" false $feature_respond -}}
230+
{{- end }}
231+
{{- end }}
232+
217233
{{- define "host.monitor_key" }}
218234
{{- if hasKey . "monitoring" }}
219235
{{- print "monitoring" }}

charts/shield/tests/host/daemonset_test.yaml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,80 @@ tests:
248248
- notExists:
249249
path: spec.template.spec.volumes[?(@.name == "host-tmp")]
250250

251+
- it: Host root mounted when response_actions is enabled (additional_settings)
252+
set:
253+
host:
254+
additional_settings:
255+
features:
256+
respond:
257+
response_actions:
258+
enabled: true
259+
asserts:
260+
- contains:
261+
path: spec.template.spec.volumes
262+
content:
263+
name: host-root
264+
hostPath:
265+
path: /
266+
- contains:
267+
path: spec.template.spec.containers[?(@.name == "sysdig-host-shield")].volumeMounts
268+
content:
269+
name: host-root
270+
mountPath: /host
271+
readOnly: true
272+
- notExists:
273+
path: spec.template.spec.volumes[?(@.name == "host-tmp")]
274+
275+
- it: Host root mounted when response_actions is enabled (features)
276+
set:
277+
features:
278+
respond:
279+
response_actions:
280+
enabled: true
281+
asserts:
282+
- contains:
283+
path: spec.template.spec.volumes
284+
content:
285+
name: host-root
286+
hostPath:
287+
path: /
288+
- contains:
289+
path: spec.template.spec.containers[?(@.name == "sysdig-host-shield")].volumeMounts
290+
content:
291+
name: host-root
292+
mountPath: /host
293+
readOnly: true
294+
- notExists:
295+
path: spec.template.spec.volumes[?(@.name == "host-tmp")]
296+
297+
- it: Host root mounted when response_actions is enabled (only on additional_settings)
298+
set:
299+
features:
300+
respond:
301+
response_actions:
302+
enabled: false
303+
host:
304+
additional_settings:
305+
features:
306+
respond:
307+
response_actions:
308+
enabled: true
309+
asserts:
310+
- contains:
311+
path: spec.template.spec.volumes
312+
content:
313+
name: host-root
314+
hostPath:
315+
path: /
316+
- contains:
317+
path: spec.template.spec.containers[?(@.name == "sysdig-host-shield")].volumeMounts
318+
content:
319+
name: host-root
320+
mountPath: /host
321+
readOnly: true
322+
- notExists:
323+
path: spec.template.spec.volumes[?(@.name == "host-tmp")]
324+
251325
- it: Host root mounted when host scanner is enabled
252326
set:
253327
features:

charts/sysdig-deploy/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: sysdig-deploy
33
description: A chart with various Sysdig components for Kubernetes
44
type: application
5-
version: 1.80.2
5+
version: 1.80.3
66
maintainers:
77
- name: AlbertoBarba
88
@@ -26,7 +26,7 @@ dependencies:
2626
- name: agent
2727
# repository: https://charts.sysdig.com
2828
repository: file://../agent
29-
version: ~1.36.5
29+
version: ~1.36.6
3030
alias: agent
3131
condition: agent.enabled
3232
- name: common

0 commit comments

Comments
 (0)