Add scripts command

This commit is contained in:
M. Mert Yildiran
2023-02-14 20:23:25 +03:00
parent 85da7f71ac
commit 41ba509428
8 changed files with 321 additions and 55 deletions

View File

@@ -14,7 +14,7 @@ import (
"github.com/rs/zerolog/log"
)
func runProxy() {
func runProxy(block bool) {
kubernetesProvider, err := getKubernetesProviderForCli()
if err != nil {
return
@@ -64,7 +64,7 @@ func runProxy() {
var establishedProxy bool
hubUrl := kubernetes.GetLocalhostOnPort(config.Config.Tap.Proxy.Hub.SrcPort)
response, err := http.Get(fmt.Sprintf("%s/", hubUrl))
response, err := http.Get(fmt.Sprintf("%s/echo", hubUrl))
if err == nil && response.StatusCode == 200 {
log.Info().
Str("service", kubernetes.HubServiceName).
@@ -123,7 +123,7 @@ func runProxy() {
okToOpen("Kubeshark", frontUrl, false)
}
if establishedProxy {
if establishedProxy && block {
utils.WaitForTermination(ctx, cancel)
}
}