mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-07-31 08:20:25 +00:00
✨ Call POST /scripts/done
after the posting the scripts to mark the end
This commit is contained in:
parent
a6dd98d241
commit
2a20dc173c
@ -450,6 +450,8 @@ func postHubStarted(ctx context.Context, kubernetesProvider *kubernetes.Provider
|
||||
connector.PostScript(script)
|
||||
}
|
||||
|
||||
connector.PostScriptDone()
|
||||
|
||||
// Hub proxy URL
|
||||
url := kubernetes.GetLocalhostOnPort(config.Config.Tap.Proxy.Hub.SrcPort)
|
||||
log.Info().Str("url", url).Msg(fmt.Sprintf(utils.Green, "Hub is available at:"))
|
||||
|
@ -228,3 +228,23 @@ func (connector *Connector) PostScript(script *configStructs.Script) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (connector *Connector) PostScriptDone() {
|
||||
postScripDonetUrl := fmt.Sprintf("%s/scripts/done", connector.url)
|
||||
|
||||
ok := false
|
||||
var err error
|
||||
for !ok {
|
||||
var resp *http.Response
|
||||
if resp, err = utils.Post(postScripDonetUrl, "application/json", nil, connector.client); err != nil || resp.StatusCode != http.StatusOK {
|
||||
if _, ok := err.(*url.Error); ok {
|
||||
break
|
||||
}
|
||||
log.Debug().Err(err).Msg("Failed sending the POST script done to Hub:")
|
||||
} else {
|
||||
ok = true
|
||||
log.Debug().Msg("Reported POST script done to Hub:")
|
||||
}
|
||||
time.Sleep(time.Second)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user