mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-06-23 14:58:44 +00:00
⚡ Add -debug
flag if debug mode is enabled
This commit is contained in:
parent
afbd6963b8
commit
74da75e966
@ -108,9 +108,14 @@ func pcap() {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cmdHub := []string{"-port", fmt.Sprintf("%d", config.Config.Tap.Hub.DstPort)}
|
||||||
|
if config.DebugMode {
|
||||||
|
cmdHub = append(cmdHub, fmt.Sprintf("-%s", config.DebugFlag))
|
||||||
|
}
|
||||||
|
|
||||||
respHub, err := cli.ContainerCreate(ctx, &container.Config{
|
respHub, err := cli.ContainerCreate(ctx, &container.Config{
|
||||||
Image: imageHub,
|
Image: imageHub,
|
||||||
Cmd: []string{"-port", fmt.Sprintf("%d", config.Config.Tap.Hub.DstPort), "-debug"},
|
Cmd: cmdHub,
|
||||||
Tty: false,
|
Tty: false,
|
||||||
ExposedPorts: nat.PortSet{nat.Port(fmt.Sprintf("%d/tcp", config.Config.Tap.Hub.DstPort)): {}},
|
ExposedPorts: nat.PortSet{nat.Port(fmt.Sprintf("%d/tcp", config.Config.Tap.Hub.DstPort)): {}},
|
||||||
}, hostConfigHub, nil, nil, "kubeshark-hub")
|
}, hostConfigHub, nil, nil, "kubeshark-hub")
|
||||||
@ -124,9 +129,14 @@ func pcap() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cmdWorker := []string{"-i", "any", "-port", fmt.Sprintf("%d", config.Config.Tap.Worker.DstPort)}
|
||||||
|
if config.DebugMode {
|
||||||
|
cmdWorker = append(cmdWorker, fmt.Sprintf("-%s", config.DebugFlag))
|
||||||
|
}
|
||||||
|
|
||||||
respWorker, err := cli.ContainerCreate(ctx, &container.Config{
|
respWorker, err := cli.ContainerCreate(ctx, &container.Config{
|
||||||
Image: imageWorker,
|
Image: imageWorker,
|
||||||
Cmd: []string{"-i", "any", "-port", fmt.Sprintf("%d", config.Config.Tap.Worker.DstPort), "-debug"},
|
Cmd: cmdWorker,
|
||||||
Tty: false,
|
Tty: false,
|
||||||
}, nil, nil, nil, "kubeshark-worker")
|
}, nil, nil, nil, "kubeshark-worker")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -32,7 +32,7 @@ func init() {
|
|||||||
|
|
||||||
rootCmd.PersistentFlags().StringSlice(config.SetCommandName, []string{}, fmt.Sprintf("Override values using --%s", config.SetCommandName))
|
rootCmd.PersistentFlags().StringSlice(config.SetCommandName, []string{}, fmt.Sprintf("Override values using --%s", config.SetCommandName))
|
||||||
rootCmd.PersistentFlags().String(config.ConfigFilePathCommandName, defaultConfig.ConfigFilePath, fmt.Sprintf("Override config file path using --%s", config.ConfigFilePathCommandName))
|
rootCmd.PersistentFlags().String(config.ConfigFilePathCommandName, defaultConfig.ConfigFilePath, fmt.Sprintf("Override config file path using --%s", config.ConfigFilePathCommandName))
|
||||||
rootCmd.PersistentFlags().BoolP("debug", "d", false, "Enable debug mode.")
|
rootCmd.PersistentFlags().BoolP(config.DebugFlag, "d", false, "Enable debug mode.")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute adds all child commands to the root command and sets flags appropriately.
|
// Execute adds all child commands to the root command and sets flags appropriately.
|
||||||
|
Loading…
Reference in New Issue
Block a user