From ff5aa572edb9cb4481f7a5f959e6299684718c11 Mon Sep 17 00:00:00 2001 From: Nithunikzz Date: Wed, 13 Mar 2024 10:50:28 +0530 Subject: [PATCH] trivy image scan --- agent/kubviz/k8smetrics_agent.go | 74 ++++++++++++++++---------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/agent/kubviz/k8smetrics_agent.go b/agent/kubviz/k8smetrics_agent.go index 068360eb..a738561f 100644 --- a/agent/kubviz/k8smetrics_agent.go +++ b/agent/kubviz/k8smetrics_agent.go @@ -12,10 +12,10 @@ import ( "github.com/go-co-op/gocron" "github.com/nats-io/nats.go" - "context" + //"context" "github.com/intelops/kubviz/pkg/mtlsnats" - "github.com/intelops/kubviz/pkg/opentelemetry" + //"github.com/intelops/kubviz/pkg/opentelemetry" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" @@ -23,13 +23,13 @@ import ( "github.com/intelops/kubviz/agent/config" "github.com/intelops/kubviz/agent/kubviz/plugins/events" - "github.com/intelops/kubviz/agent/kubviz/plugins/ketall" - "github.com/intelops/kubviz/agent/kubviz/plugins/kubepreupgrade" + // "github.com/intelops/kubviz/agent/kubviz/plugins/ketall" + // "github.com/intelops/kubviz/agent/kubviz/plugins/kubepreupgrade" - "github.com/intelops/kubviz/agent/kubviz/plugins/kuberhealthy" - "github.com/intelops/kubviz/agent/kubviz/plugins/kubescore" - "github.com/intelops/kubviz/agent/kubviz/plugins/outdated" - "github.com/intelops/kubviz/agent/kubviz/plugins/rakkess" + // "github.com/intelops/kubviz/agent/kubviz/plugins/kuberhealthy" + // "github.com/intelops/kubviz/agent/kubviz/plugins/kubescore" + // "github.com/intelops/kubviz/agent/kubviz/plugins/outdated" + // "github.com/intelops/kubviz/agent/kubviz/plugins/rakkess" "github.com/intelops/kubviz/agent/kubviz/plugins/trivy" "github.com/intelops/kubviz/agent/kubviz/scheduler" @@ -67,7 +67,7 @@ var ( func main() { log.SetFlags(log.LstdFlags | log.Lshortfile) env := Production - clusterMetricsChan := make(chan error, 1) + //clusterMetricsChan := make(chan error, 1) cfg, err := config.GetAgentConfigurations() if err != nil { log.Fatal("Failed to retrieve agent configurations", err) @@ -121,38 +121,38 @@ func main() { clientset = events.GetK8sClient(config) } - tp, err := opentelemetry.InitTracer() - if err != nil { - log.Fatal(err) - } - defer func() { - if err := tp.Shutdown(context.Background()); err != nil { - log.Printf("Error shutting down tracer provider: %v", err) - } - }() - - go events.PublishMetrics(clientset, js, clusterMetricsChan) - if cfg.KuberHealthyEnable { - go kuberhealthy.StartKuberHealthy(js) - } + // tp, err := opentelemetry.InitTracer() + // if err != nil { + // log.Fatal(err) + // } + // defer func() { + // if err := tp.Shutdown(context.Background()); err != nil { + // log.Printf("Error shutting down tracer provider: %v", err) + // } + // }() + + // go events.PublishMetrics(clientset, js, clusterMetricsChan) + // if cfg.KuberHealthyEnable { + // go kuberhealthy.StartKuberHealthy(js) + // } go server.StartServer() collectAndPublishMetrics := func() { - err := outdated.OutDatedImages(config, js) - events.LogErr(err) - err = kubepreupgrade.KubePreUpgradeDetector(config, js) - events.LogErr(err) - err = ketall.GetAllResources(config, js) - events.LogErr(err) - err = rakkess.RakeesOutput(config, js) - events.LogErr(err) - err = trivy.RunTrivySbomScan(config, js) - events.LogErr(err) + // err := outdated.OutDatedImages(config, js) + // events.LogErr(err) + // err = kubepreupgrade.KubePreUpgradeDetector(config, js) + // events.LogErr(err) + // err = ketall.GetAllResources(config, js) + // events.LogErr(err) + // err = rakkess.RakeesOutput(config, js) + // events.LogErr(err) + // err = trivy.RunTrivySbomScan(config, js) + // events.LogErr(err) err = trivy.RunTrivyImageScans(config, js) events.LogErr(err) - err = trivy.RunTrivyK8sClusterScan(js) - events.LogErr(err) - err = kubescore.RunKubeScore(clientset, js) - events.LogErr(err) + // err = trivy.RunTrivyK8sClusterScan(js) + // events.LogErr(err) + // err = kubescore.RunKubeScore(clientset, js) + // events.LogErr(err) } collectAndPublishMetrics()