mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-09-05 20:42:46 +00:00
Add support of listening to multiple netns (#418)
* multiple netns listen - initial commit * multiple netns listen - actual work * remove redundant log line * map /proc of host to tapper * changing kubernetes provider again after big conflict * revert node-sass version back to 5.0.0 * Rename host_source to hostSource Co-authored-by: gadotroee <55343099+gadotroee@users.noreply.github.com> * PR fixes - adding comment + typos + naming conventions * go fmt + making procfs read only * setns back to the original value after packet source initialized Co-authored-by: gadotroee <55343099+gadotroee@users.noreply.github.com>
This commit is contained in:
@@ -45,6 +45,8 @@ type Provider struct {
|
||||
|
||||
const (
|
||||
fieldManagerName = "mizu-manager"
|
||||
procfsVolumeName = "proc"
|
||||
procfsMountPath = "/hostproc"
|
||||
)
|
||||
|
||||
func NewProvider(kubeConfigPath string) (*Provider, error) {
|
||||
@@ -641,6 +643,7 @@ func (provider *Provider) ApplyMizuTapperDaemonSet(ctx context.Context, namespac
|
||||
"--tap",
|
||||
"--api-server-address", fmt.Sprintf("ws://%s/wsTapper", apiServerPodIp),
|
||||
"--nodefrag",
|
||||
"--procfs", procfsMountPath,
|
||||
}
|
||||
|
||||
debugMode := ""
|
||||
@@ -719,6 +722,14 @@ func (provider *Provider) ApplyMizuTapperDaemonSet(ctx context.Context, namespac
|
||||
noScheduleToleration.WithOperator(core.TolerationOpExists)
|
||||
noScheduleToleration.WithEffect(core.TaintEffectNoSchedule)
|
||||
|
||||
// Host procfs is needed inside the container because we need access to
|
||||
// the network namespaces of processes on the machine.
|
||||
//
|
||||
procfsVolume := applyconfcore.Volume()
|
||||
procfsVolume.WithName(procfsVolumeName).WithHostPath(applyconfcore.HostPathVolumeSource().WithPath("/proc"))
|
||||
volumeMount := applyconfcore.VolumeMount().WithName(procfsVolumeName).WithMountPath(procfsMountPath).WithReadOnly(true)
|
||||
agentContainer.WithVolumeMounts(volumeMount)
|
||||
|
||||
volumeName := ConfigMapName
|
||||
configMapVolume := applyconfcore.VolumeApplyConfiguration{
|
||||
Name: &volumeName,
|
||||
@@ -747,7 +758,7 @@ func (provider *Provider) ApplyMizuTapperDaemonSet(ctx context.Context, namespac
|
||||
podSpec.WithContainers(agentContainer)
|
||||
podSpec.WithAffinity(affinity)
|
||||
podSpec.WithTolerations(noExecuteToleration, noScheduleToleration)
|
||||
podSpec.WithVolumes(&configMapVolume)
|
||||
podSpec.WithVolumes(&configMapVolume, procfsVolume)
|
||||
|
||||
podTemplate := applyconfcore.PodTemplateSpec()
|
||||
podTemplate.WithLabels(map[string]string{"app": tapperPodName})
|
||||
|
Reference in New Issue
Block a user