Skip to content

Commit

Permalink
Merge pull request #441 from kubescape/fix
Browse files Browse the repository at this point in the history
copy igK8sClient.RuntimeConfig and unset RuntimeProtocol for our usage
  • Loading branch information
matthyx authored Dec 19, 2024
2 parents f6f805d + 082d6aa commit 9926c89
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/grafana/pyroscope-go"
igconfig "github.com/inspektor-gadget/inspektor-gadget/pkg/config"
containercollection "github.com/inspektor-gadget/inspektor-gadget/pkg/container-collection"
igtypes "github.com/inspektor-gadget/inspektor-gadget/pkg/container-utils/types"
beUtils "github.com/kubescape/backend/pkg/utils"
"github.com/kubescape/go-logger"
"github.com/kubescape/go-logger/helpers"
Expand Down Expand Up @@ -290,7 +291,17 @@ func main() {
}
defer igK8sClient.Close()
logger.L().Info("IG Kubernetes client created", helpers.Interface("client", igK8sClient))
logger.L().Info("Detected container runtime", helpers.String("containerRuntime", igK8sClient.RuntimeConfig.Name.String()))

// Detect the container containerRuntime of the node
containerRuntime := &igtypes.RuntimeConfig{
Name: igK8sClient.RuntimeConfig.Name,
SocketPath: igK8sClient.RuntimeConfig.SocketPath,
RuntimeProtocol: "", // deliberately empty
Extra: igtypes.ExtraConfig{
Namespace: igK8sClient.RuntimeConfig.Extra.Namespace,
},
}
logger.L().Info("Detected container runtime", helpers.String("containerRuntime", containerRuntime.Name.String()))

// Create the SBOM manager
var sbomManager sbommanager.SbomManagerClient
Expand All @@ -304,7 +315,7 @@ func main() {
}

// Create the container handler
mainHandler, err := containerwatcher.CreateIGContainerWatcher(cfg, applicationProfileManager, k8sClient, igK8sClient, networkManagerClient, dnsManagerClient, prometheusExporter, ruleManager, malwareManager, sbomManager, preRunningContainersIDs, &ruleBindingNotify, igK8sClient.RuntimeConfig, nil, nil, processManager)
mainHandler, err := containerwatcher.CreateIGContainerWatcher(cfg, applicationProfileManager, k8sClient, igK8sClient, networkManagerClient, dnsManagerClient, prometheusExporter, ruleManager, malwareManager, sbomManager, preRunningContainersIDs, &ruleBindingNotify, containerRuntime, nil, nil, processManager)
if err != nil {
logger.L().Ctx(ctx).Fatal("error creating the container watcher", helpers.Error(err))
}
Expand Down

0 comments on commit 9926c89

Please sign in to comment.