Make the scritps command directly use the K8s API without requiring a connector to Hub (#1615)

* Make the `scritps` command directly use the K8s API without requiring a connector to Hub

* Fix linter

* Fix linter

---------

Co-authored-by: Alon Girmonsky <1990761+alongir@users.noreply.github.com>
This commit is contained in:
M. Mert Yildiran
2024-09-23 20:11:44 +03:00
committed by GitHub
parent 98173350ec
commit 3d5c999be1
5 changed files with 132 additions and 157 deletions

View File

@@ -10,7 +10,6 @@ import (
"sync"
"time"
"github.com/kubeshark/kubeshark/internal/connect"
"github.com/kubeshark/kubeshark/kubernetes/helm"
"github.com/kubeshark/kubeshark/misc"
"github.com/kubeshark/kubeshark/utils"
@@ -32,7 +31,6 @@ type tapState struct {
}
var state tapState
var connector *connect.Connector
type Readiness struct {
Hub bool
@@ -52,8 +50,6 @@ func tap() {
Str("limit", config.Config.Tap.StorageLimit).
Msg(fmt.Sprintf("%s will store the traffic up to a limit (per node). Oldest TCP/UDP streams will be removed once the limit is reached.", misc.Software))
connector = connect.NewConnector(kubernetes.GetHubUrl(), connect.DefaultRetries, connect.DefaultTimeout)
kubernetesProvider, err := getKubernetesProviderForCli(false, false)
if err != nil {
log.Error().Err(err).Send()
@@ -429,7 +425,7 @@ func postFrontStarted(ctx context.Context, kubernetesProvider *kubernetes.Provid
}
if config.Config.Scripting.Source != "" && config.Config.Scripting.WatchScripts {
watchScripts(false)
watchScripts(kubernetesProvider, false)
}
}