Skip to content

Commit

Permalink
service discovery: Add missing cgroup mount (#1610)
Browse files Browse the repository at this point in the history
* service discovery: Add missing cgroup mount

Add a missing cgroup mount to system-probe which is required to get
container information.

* Update test
  • Loading branch information
vitkyrka authored Jan 10, 2025
1 parent a3e7eab commit d49f7c2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ func (f *serviceDiscoveryFeature) ManageNodeAgent(managers feature.PodTemplateMa
managers.VolumeMount().AddVolumeMountToContainer(&procdirMount, apicommon.SystemProbeContainerName)
managers.Volume().AddVolume(&procdirVol)

// Needed to resolve container information
cgroupsVol, cgroupsMount := volume.GetVolumes(v2alpha1.CgroupsVolumeName, v2alpha1.CgroupsHostPath, v2alpha1.CgroupsMountPath, true)
managers.VolumeMount().AddVolumeMountToContainer(&cgroupsMount, apicommon.SystemProbeContainerName)
managers.Volume().AddVolume(&cgroupsVol)

socketVol, socketVolMount := volume.GetVolumesEmptyDir(v2alpha1.SystemProbeSocketVolumeName, v2alpha1.SystemProbeSocketVolumePath, false)
managers.Volume().AddVolume(&socketVol)
managers.VolumeMount().AddVolumeMountToContainer(&socketVolMount, apicommon.SystemProbeContainerName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ func Test_serviceDiscoveryFeature_Configure(t *testing.T) {
MountPath: v2alpha1.ProcdirMountPath,
ReadOnly: true,
},
{
Name: v2alpha1.CgroupsVolumeName,
MountPath: v2alpha1.CgroupsMountPath,
ReadOnly: true,
},
{
Name: v2alpha1.SystemProbeSocketVolumeName,
MountPath: v2alpha1.SystemProbeSocketVolumePath,
Expand All @@ -86,6 +91,14 @@ func Test_serviceDiscoveryFeature_Configure(t *testing.T) {
},
},
},
{
Name: v2alpha1.CgroupsVolumeName,
VolumeSource: corev1.VolumeSource{
HostPath: &corev1.HostPathVolumeSource{
Path: v2alpha1.CgroupsHostPath,
},
},
},
{
Name: v2alpha1.SystemProbeSocketVolumeName,
VolumeSource: corev1.VolumeSource{
Expand Down

0 comments on commit d49f7c2

Please sign in to comment.