Only record traffic of the requested pod. Filtered by pod IP. (#21)

This commit is contained in:
nimrod-up9
2021-04-29 18:19:59 +03:00
committed by GitHub
parent 2ba43300fd
commit e932a340e3
5 changed files with 28 additions and 7 deletions

View File

@@ -19,6 +19,3 @@ build-cr:
clean:
#go clean
rm -f ./bin/*
run:
go run . ".*"

View File

@@ -4,6 +4,7 @@ import (
_ "bytes"
"context"
"fmt"
"strings"
core "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -76,6 +77,12 @@ func (provider *Provider) CreateMizuPod(ctx context.Context, podName string, pod
panic(err.Error())
}
podIps := make([]string, len(tappedPod.Status.PodIPs))
for ii, podIp := range tappedPod.Status.PodIPs {
podIps[ii] = podIp.IP
}
podIpsString := strings.Join(podIps, ",")
privileged := true
pod := &core.Pod{
ObjectMeta: metav1.ObjectMeta{
@@ -97,6 +104,10 @@ func (provider *Provider) CreateMizuPod(ctx context.Context, podName string, pod
Name: "HOST_MODE",
Value: "1",
},
{
Name: "TAPPED_ADDRESSES",
Value: podIpsString,
},
},
},
},