mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-07-16 09:26:39 +00:00
🔨 Add more logging to PCAP runner
This commit is contained in:
parent
46c5e18937
commit
09f1669627
@ -98,6 +98,8 @@ func createAndStartContainers(
|
||||
workerIPAddr string,
|
||||
err error,
|
||||
) {
|
||||
log.Info().Msg("Creating containers...")
|
||||
|
||||
hostIP := "0.0.0.0"
|
||||
|
||||
hostConfigFront := &container.HostConfig{
|
||||
@ -124,10 +126,6 @@ func createAndStartContainers(
|
||||
return
|
||||
}
|
||||
|
||||
if err = cli.ContainerStart(ctx, respFront.ID, types.ContainerStartOptions{}); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
hostConfigHub := &container.HostConfig{
|
||||
PortBindings: nat.PortMap{
|
||||
nat.Port(fmt.Sprintf("%d/tcp", config.Config.Tap.Proxy.Hub.DstPort)): []nat.PortBinding{
|
||||
@ -154,10 +152,6 @@ func createAndStartContainers(
|
||||
return
|
||||
}
|
||||
|
||||
if err = cli.ContainerStart(ctx, respHub.ID, types.ContainerStartOptions{}); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
cmdWorker := []string{"-f", "./import", "-port", fmt.Sprintf("%d", config.Config.Tap.Proxy.Worker.DstPort)}
|
||||
if config.DebugMode {
|
||||
cmdWorker = append(cmdWorker, fmt.Sprintf("-%s", config.DebugFlag))
|
||||
@ -176,6 +170,16 @@ func createAndStartContainers(
|
||||
return
|
||||
}
|
||||
|
||||
log.Info().Msg("Starting containers...")
|
||||
|
||||
if err = cli.ContainerStart(ctx, respFront.ID, types.ContainerStartOptions{}); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = cli.ContainerStart(ctx, respHub.ID, types.ContainerStartOptions{}); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = cli.ContainerStart(ctx, respWorker.ID, types.ContainerStartOptions{}); err != nil {
|
||||
return
|
||||
}
|
||||
@ -198,6 +202,7 @@ func stopAndRemoveContainers(
|
||||
respHub container.ContainerCreateCreatedBody,
|
||||
respWorker container.ContainerCreateCreatedBody,
|
||||
) (err error) {
|
||||
log.Warn().Msg("Stopping containers...")
|
||||
err = cli.ContainerStop(ctx, respFront.ID, nil)
|
||||
if err != nil {
|
||||
return
|
||||
@ -211,6 +216,7 @@ func stopAndRemoveContainers(
|
||||
return
|
||||
}
|
||||
|
||||
log.Warn().Msg("Removing containers...")
|
||||
err = cli.ContainerRemove(ctx, respFront.ID, types.ContainerRemoveOptions{})
|
||||
if err != nil {
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user