Skip to content

Commit 24f1c33

Browse files
authored
Revert "[CWS] Add missing system-probe cws volume mount points (#2308)" (#2316)
This reverts commit c956954.
1 parent 6001d5a commit 24f1c33

File tree

4 files changed

+23
-41
lines changed

4 files changed

+23
-41
lines changed

internal/controller/datadogagent/component/agent/default.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -750,9 +750,6 @@ func volumeMountsForSystemProbe() []corev1.VolumeMount {
750750
common.GetVolumeMountForLogs(),
751751
common.GetVolumeMountForAuth(true),
752752
common.GetVolumeMountForConfig(),
753-
common.GetVolumeMountForDogstatsdSocket(false),
754-
common.GetVolumeMountForRuntimeSocket(true),
755-
common.GetVolumeMountForProc(),
756753
}
757754
}
758755

internal/controller/datadogagent/feature/cws/const.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ const (
1313
securityAgentRuntimePoliciesDirVolumeName = "runtimepoliciesdir"
1414
securityAgentRuntimePoliciesDirVolumePath = "/etc/datadog-agent/runtime-security.d"
1515

16-
tracefsVolumeName = "tracefs"
17-
tracefsPath = "/sys/kernel/tracing"
16+
tracefsVolumeName = "tracefs"
17+
tracefsPath = "/sys/kernel/tracing"
18+
securityfsVolumeName = "securityfs"
19+
securityfsVolumePath = "/sys/kernel/security"
20+
securityfsMountPath = "/host/sys/kernel/security"
1821

1922
// DefaultCWSConf default CWS ConfigMap name
2023
defaultCWSConf string = "cws-config"

internal/controller/datadogagent/feature/cws/feature.go

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,11 @@ func (f *cwsFeature) ManageNodeAgent(managers feature.PodTemplateManagers, provi
271271
volMountMgr.AddVolumeMountToContainer(&tracefsVolMount, apicommon.SystemProbeContainerName)
272272
volMgr.AddVolume(&tracefsVol)
273273

274+
// securityfs volume mount
275+
securityfsVol, securityfsVolMount := volume.GetVolumes(securityfsVolumeName, securityfsVolumePath, securityfsMountPath, true)
276+
volMountMgr.AddVolumeMountToContainer(&securityfsVolMount, apicommon.SystemProbeContainerName)
277+
volMgr.AddVolume(&securityfsVol)
278+
274279
// socket volume mount (needs write perms for the system probe container but not the others)
275280
socketVol, socketVolMount := volume.GetVolumesEmptyDir(common.SystemProbeSocketVolumeName, common.SystemProbeSocketVolumePath, false)
276281
volMountMgr.AddVolumeMountToContainer(&socketVolMount, apicommon.SystemProbeContainerName)
@@ -309,16 +314,6 @@ func (f *cwsFeature) ManageNodeAgent(managers feature.PodTemplateManagers, provi
309314
volMountMgr.AddVolumeMountToContainer(&osReleaseVolMount, apicommon.SystemProbeContainerName)
310315
volMgr.AddVolume(&osReleaseVol)
311316

312-
// cgroup volume mount
313-
cgroupsVol, cgroupsVolMount := volume.GetVolumes(common.CgroupsVolumeName, common.CgroupsHostPath, common.CgroupsMountPath, true)
314-
volMountMgr.AddVolumeMountToContainer(&cgroupsVolMount, apicommon.SystemProbeContainerName)
315-
volMgr.AddVolume(&cgroupsVol)
316-
317-
// host root volume mount
318-
hostRootVol, hostRootVolMount := volume.GetVolumes(common.HostRootVolumeName, common.HostRootHostPath, common.HostRootMountPath, true)
319-
volMountMgr.AddVolumeMountToContainer(&hostRootVolMount, apicommon.SystemProbeContainerName)
320-
volMgr.AddVolume(&hostRootVol)
321-
322317
// Custom policies are copied and merged with default policies via a workaround in the init-volume container.
323318
if f.customConfig != nil {
324319
var vol corev1.Volume

internal/controller/datadogagent/feature/cws/feature_test.go

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,11 @@ func cwsAgentNodeWantFunc(withSubFeatures bool, directSendFromSysProbe bool) *te
211211
MountPath: tracefsPath,
212212
ReadOnly: false,
213213
},
214+
{
215+
Name: securityfsVolumeName,
216+
MountPath: securityfsMountPath,
217+
ReadOnly: true,
218+
},
214219
{
215220
Name: common.SystemProbeSocketVolumeName,
216221
MountPath: common.SystemProbeSocketVolumePath,
@@ -236,16 +241,6 @@ func cwsAgentNodeWantFunc(withSubFeatures bool, directSendFromSysProbe bool) *te
236241
MountPath: common.SystemProbeOSReleaseDirMountPath,
237242
ReadOnly: true,
238243
},
239-
{
240-
Name: common.CgroupsVolumeName,
241-
MountPath: common.CgroupsMountPath,
242-
ReadOnly: true,
243-
},
244-
{
245-
Name: common.HostRootVolumeName,
246-
MountPath: common.HostRootMountPath,
247-
ReadOnly: true,
248-
},
249244
{
250245
Name: securityAgentRuntimePoliciesDirVolumeName,
251246
MountPath: securityAgentRuntimePoliciesDirVolumePath,
@@ -280,6 +275,14 @@ func cwsAgentNodeWantFunc(withSubFeatures bool, directSendFromSysProbe bool) *te
280275
},
281276
},
282277
},
278+
{
279+
Name: securityfsVolumeName,
280+
VolumeSource: corev1.VolumeSource{
281+
HostPath: &corev1.HostPathVolumeSource{
282+
Path: securityfsVolumePath,
283+
},
284+
},
285+
},
283286
{
284287
Name: common.SystemProbeSocketVolumeName,
285288
VolumeSource: corev1.VolumeSource{
@@ -318,22 +321,6 @@ func cwsAgentNodeWantFunc(withSubFeatures bool, directSendFromSysProbe bool) *te
318321
},
319322
},
320323
},
321-
{
322-
Name: common.CgroupsVolumeName,
323-
VolumeSource: corev1.VolumeSource{
324-
HostPath: &corev1.HostPathVolumeSource{
325-
Path: common.CgroupsHostPath,
326-
},
327-
},
328-
},
329-
{
330-
Name: common.HostRootVolumeName,
331-
VolumeSource: corev1.VolumeSource{
332-
HostPath: &corev1.HostPathVolumeSource{
333-
Path: common.HostRootHostPath,
334-
},
335-
},
336-
},
337324
{
338325
Name: cwsConfigVolumeName,
339326
VolumeSource: corev1.VolumeSource{

0 commit comments

Comments
 (0)