From 1fdc4c9b863377e68a9b2152457a10d606b11ca8 Mon Sep 17 00:00:00 2001 From: Nithunikzz Date: Mon, 18 Mar 2024 11:36:01 +0530 Subject: [PATCH 1/9] Scheduler change for trivy --- agent/config/config.go | 22 ++--- agent/kubviz/k8smetrics_agent.go | 2 +- agent/kubviz/scheduler/scheduler.go | 26 +++++- agent/kubviz/scheduler/scheduler_watch.go | 100 +++++++++++++++++----- 4 files changed, 116 insertions(+), 34 deletions(-) diff --git a/agent/config/config.go b/agent/config/config.go index 632b3332..8e906ce1 100644 --- a/agent/config/config.go +++ b/agent/config/config.go @@ -8,16 +8,18 @@ import ( ) type AgentConfigurations struct { - SANamespace string `envconfig:"SA_NAMESPACE" default:"default"` - SAName string `envconfig:"SA_NAME" default:"default"` - OutdatedInterval string `envconfig:"OUTDATED_INTERVAL" default:"0"` - GetAllInterval string `envconfig:"GETALL_INTERVAL" default:"*/30 * * * *"` - KubeScoreInterval string `envconfig:"KUBESCORE_INTERVAL" default:"*/40 * * * *"` - RakkessInterval string `envconfig:"RAKKESS_INTERVAL" default:"*/50 * * * *"` - KubePreUpgradeInterval string `envconfig:"KUBEPREUPGRADE_INTERVAL" default:"*/60 * * * *"` - TrivyInterval string `envconfig:"TRIVY_INTERVAL" default:"*/10 * * * *"` - SchedulerEnable bool `envconfig:"SCHEDULER_ENABLE" default:"true"` - KuberHealthyEnable bool `envconfig:"KUBERHEALTHY_ENABLE" default:"true"` + SANamespace string `envconfig:"SA_NAMESPACE" default:"default"` + SAName string `envconfig:"SA_NAME" default:"default"` + OutdatedInterval string `envconfig:"OUTDATED_INTERVAL" default:"0"` + GetAllInterval string `envconfig:"GETALL_INTERVAL" default:"*/30 * * * *"` + KubeScoreInterval string `envconfig:"KUBESCORE_INTERVAL" default:"*/40 * * * *"` + RakkessInterval string `envconfig:"RAKKESS_INTERVAL" default:"*/50 * * * *"` + KubePreUpgradeInterval string `envconfig:"KUBEPREUPGRADE_INTERVAL" default:"*/60 * * * *"` + TrivyImageInterval string `envconfig:"TRIVY_IMAGE_INTERVAL" default:"*/10 * * * *"` + TrivySbomInterval string `envconfig:"TRIVY_SBOM_INTERVAL" default:"*/20 * * * *"` + TrivyClusterScanInterval string `envconfig:"TRIVY_CLUSTERSCAN_INTERVAL" default:"*/35 * * * *"` + SchedulerEnable bool `envconfig:"SCHEDULER_ENABLE" default:"true"` + KuberHealthyEnable bool `envconfig:"KUBERHEALTHY_ENABLE" default:"true"` } func GetAgentConfigurations() (serviceConf *AgentConfigurations, err error) { diff --git a/agent/kubviz/k8smetrics_agent.go b/agent/kubviz/k8smetrics_agent.go index 068360eb..f5a874f1 100644 --- a/agent/kubviz/k8smetrics_agent.go +++ b/agent/kubviz/k8smetrics_agent.go @@ -155,7 +155,7 @@ func main() { events.LogErr(err) } - collectAndPublishMetrics() + //collectAndPublishMetrics() if cfg.SchedulerEnable { // Assuming "cfg.Schedule" is a boolean indicating whether to schedule or not. scheduler := scheduler.InitScheduler(config, js, *cfg, clientset) diff --git a/agent/kubviz/scheduler/scheduler.go b/agent/kubviz/scheduler/scheduler.go index f56660bc..ccd9564e 100644 --- a/agent/kubviz/scheduler/scheduler.go +++ b/agent/kubviz/scheduler/scheduler.go @@ -144,12 +144,32 @@ func InitScheduler(config *rest.Config, js nats.JetStreamContext, cfg config.Age log.Fatal("failed to do job", err) } } - if cfg.TrivyInterval != "" && cfg.TrivyInterval != "0" { - sj, err := NewTrivyJob(config, js, cfg.TrivyInterval) + if cfg.TrivyImageInterval != "" && cfg.TrivyImageInterval != "0" { + sj, err := NewTrivyImagesJob(config, js, cfg.TrivyImageInterval) if err != nil { log.Fatal("no time interval", err) } - err = s.AddJob("Trivy", sj) + err = s.AddJob("Trivyimage", sj) + if err != nil { + log.Fatal("failed to do job", err) + } + } + if cfg.TrivySbomInterval != "" && cfg.TrivySbomInterval != "0" { + sj, err := NewTrivySbomJob(config, js, cfg.TrivySbomInterval) + if err != nil { + log.Fatal("no time interval", err) + } + err = s.AddJob("Trivysbom", sj) + if err != nil { + log.Fatal("failed to do job", err) + } + } + if cfg.TrivyClusterScanInterval != "" && cfg.TrivyClusterScanInterval != "0" { + sj, err := NewTrivyClusterScanJob(js, cfg.TrivyClusterScanInterval) + if err != nil { + log.Fatal("no time interval", err) + } + err = s.AddJob("Trivycluster", sj) if err != nil { log.Fatal("failed to do job", err) } diff --git a/agent/kubviz/scheduler/scheduler_watch.go b/agent/kubviz/scheduler/scheduler_watch.go index 9b338cf7..cadeb462 100644 --- a/agent/kubviz/scheduler/scheduler_watch.go +++ b/agent/kubviz/scheduler/scheduler_watch.go @@ -25,11 +25,21 @@ type KetallJob struct { js nats.JetStreamContext frequency string } -type TrivyJob struct { +type TrivyImageJob struct { config *rest.Config js nats.JetStreamContext frequency string } +type TrivySbomJob struct { + config *rest.Config + js nats.JetStreamContext + frequency string +} +type TrivyClusterScanJob struct { + //config *rest.Config + js nats.JetStreamContext + frequency string +} type RakkessJob struct { config *rest.Config js nats.JetStreamContext @@ -46,6 +56,55 @@ type KubescoreJob struct { frequency string } +func NewTrivySbomJob(config *rest.Config, js nats.JetStreamContext, frequency string) (*TrivySbomJob, error) { + return &TrivySbomJob{ + config: config, + js: js, + frequency: frequency, + }, nil +} +func (v *TrivySbomJob) CronSpec() string { + return v.frequency +} + +func (j *TrivySbomJob) Run() { + // Call the outDatedImages function with the provided config and js + err := trivy.RunTrivySbomScan(j.config, j.js) + events.LogErr(err) +} + +func NewTrivyClusterScanJob(js nats.JetStreamContext, frequency string) (*TrivyClusterScanJob, error) { + return &TrivyClusterScanJob{ + // config: config, + js: js, + frequency: frequency, + }, nil +} +func (v *TrivyClusterScanJob) CronSpec() string { + return v.frequency +} + +func (j *TrivyClusterScanJob) Run() { + // Call the outDatedImages function with the provided config and js + err := trivy.RunTrivyK8sClusterScan(j.js) + events.LogErr(err) +} +func NewTrivyImagesJob(config *rest.Config, js nats.JetStreamContext, frequency string) (*TrivyImageJob, error) { + return &TrivyImageJob{ + config: config, + js: js, + frequency: frequency, + }, nil +} +func (v *TrivyImageJob) CronSpec() string { + return v.frequency +} + +func (j *TrivyImageJob) Run() { + // Call the outDatedImages function with the provided config and js + err := trivy.RunTrivyImageScans(j.config, j.js) + events.LogErr(err) +} func NewOutDatedImagesJob(config *rest.Config, js nats.JetStreamContext, frequency string) (*OutDatedImagesJob, error) { return &OutDatedImagesJob{ config: config, @@ -128,23 +187,24 @@ func (j *RakkessJob) Run() { err := rakkess.RakeesOutput(j.config, j.js) events.LogErr(err) } -func NewTrivyJob(config *rest.Config, js nats.JetStreamContext, frequency string) (*TrivyJob, error) { - return &TrivyJob{ - config: config, - js: js, - frequency: frequency, - }, nil -} -func (v *TrivyJob) CronSpec() string { - return v.frequency -} -func (j *TrivyJob) Run() { - // Call the Trivy function with the provided config and js - err := trivy.RunTrivySbomScan(j.config, j.js) - events.LogErr(err) - err = trivy.RunTrivyImageScans(j.config, j.js) - events.LogErr(err) - err = trivy.RunTrivyK8sClusterScan(j.js) - events.LogErr(err) -} +// func NewTrivyJob(config *rest.Config, js nats.JetStreamContext, frequency string) (*TrivyJob, error) { +// return &TrivyJob{ +// config: config, +// js: js, +// frequency: frequency, +// }, nil +// } +// func (v *TrivyJob) CronSpec() string { +// return v.frequency +// } + +// func (j *TrivyJob) Run() { +// // Call the Trivy function with the provided config and js +// err := trivy.RunTrivySbomScan(j.config, j.js) +// events.LogErr(err) +// err = trivy.RunTrivyImageScans(j.config, j.js) +// events.LogErr(err) +// err = trivy.RunTrivyK8sClusterScan(j.js) +// events.LogErr(err) +// } From 7d603db5ba5026f8ecccb79a66889d81f2aad02d Mon Sep 17 00:00:00 2001 From: Nithunikzz Date: Mon, 18 Mar 2024 12:35:55 +0530 Subject: [PATCH 2/9] Scheduler change for trivy --- agent/kubviz/k8smetrics_agent.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/agent/kubviz/k8smetrics_agent.go b/agent/kubviz/k8smetrics_agent.go index f5a874f1..c3dbc670 100644 --- a/agent/kubviz/k8smetrics_agent.go +++ b/agent/kubviz/k8smetrics_agent.go @@ -155,8 +155,6 @@ func main() { events.LogErr(err) } - //collectAndPublishMetrics() - if cfg.SchedulerEnable { // Assuming "cfg.Schedule" is a boolean indicating whether to schedule or not. scheduler := scheduler.InitScheduler(config, js, *cfg, clientset) From c513f4110301bcac301a8a1014f044dde77b7d9a Mon Sep 17 00:00:00 2001 From: Nithunikzz Date: Mon, 18 Mar 2024 12:40:16 +0530 Subject: [PATCH 3/9] Scheduler change for trivy --- agent/kubviz/k8smetrics_agent.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/agent/kubviz/k8smetrics_agent.go b/agent/kubviz/k8smetrics_agent.go index c3dbc670..9eb16068 100644 --- a/agent/kubviz/k8smetrics_agent.go +++ b/agent/kubviz/k8smetrics_agent.go @@ -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) @@ -131,7 +131,7 @@ func main() { } }() - go events.PublishMetrics(clientset, js, clusterMetricsChan) + //go events.PublishMetrics(clientset, js, clusterMetricsChan) if cfg.KuberHealthyEnable { go kuberhealthy.StartKuberHealthy(js) } From 8875ffc8f7cf3546fe2f9db6bfa3824301ecc0f0 Mon Sep 17 00:00:00 2001 From: Nithunikzz Date: Mon, 18 Mar 2024 12:51:45 +0530 Subject: [PATCH 4/9] Scheduler change for trivy --- agent/kubviz/k8smetrics_agent.go | 56 +++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/agent/kubviz/k8smetrics_agent.go b/agent/kubviz/k8smetrics_agent.go index 9eb16068..854db18e 100644 --- a/agent/kubviz/k8smetrics_agent.go +++ b/agent/kubviz/k8smetrics_agent.go @@ -136,24 +136,24 @@ func main() { 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 = trivy.RunTrivyImageScans(config, js) - events.LogErr(err) - err = trivy.RunTrivyK8sClusterScan(js) - events.LogErr(err) - err = kubescore.RunKubeScore(clientset, js) - events.LogErr(err) - } + // 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 = trivy.RunTrivyImageScans(config, js) + // events.LogErr(err) + // err = trivy.RunTrivyK8sClusterScan(js) + // events.LogErr(err) + // err = kubescore.RunKubeScore(clientset, js) + // events.LogErr(err) + // } if cfg.SchedulerEnable { // Assuming "cfg.Schedule" is a boolean indicating whether to schedule or not. scheduler := scheduler.InitScheduler(config, js, *cfg, clientset) @@ -175,8 +175,26 @@ func main() { } s := gocron.NewScheduler(time.UTC) s.Every(schedulingInterval).Do(func() { - collectAndPublishMetrics() + collectAndPublishMetrics(config, js, clientset) }) s.StartBlocking() } } +func collectAndPublishMetrics(config *rest.Config, js nats.JetStreamContext, clientset *kubernetes.Clientset) { + 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) +} From 8ccf8ea0d14dc69d3ae266c341dbdb3d525009f0 Mon Sep 17 00:00:00 2001 From: Nithunikzz Date: Mon, 18 Mar 2024 13:01:32 +0530 Subject: [PATCH 5/9] Scheduler change for trivy --- agent/kubviz/k8smetrics_agent.go | 75 ++++++++++++++++---------------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/agent/kubviz/k8smetrics_agent.go b/agent/kubviz/k8smetrics_agent.go index 854db18e..ca32d28e 100644 --- a/agent/kubviz/k8smetrics_agent.go +++ b/agent/kubviz/k8smetrics_agent.go @@ -136,24 +136,24 @@ func main() { 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 = trivy.RunTrivyImageScans(config, js) - // events.LogErr(err) - // err = trivy.RunTrivyK8sClusterScan(js) - // events.LogErr(err) - // err = kubescore.RunKubeScore(clientset, js) - // events.LogErr(err) - // } + 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 = trivy.RunTrivyImageScans(config, js) + events.LogErr(err) + err = trivy.RunTrivyK8sClusterScan(js) + events.LogErr(err) + err = kubescore.RunKubeScore(clientset, js) + events.LogErr(err) + } if cfg.SchedulerEnable { // Assuming "cfg.Schedule" is a boolean indicating whether to schedule or not. scheduler := scheduler.InitScheduler(config, js, *cfg, clientset) @@ -175,26 +175,27 @@ func main() { } s := gocron.NewScheduler(time.UTC) s.Every(schedulingInterval).Do(func() { - collectAndPublishMetrics(config, js, clientset) + collectAndPublishMetrics() }) s.StartBlocking() } } -func collectAndPublishMetrics(config *rest.Config, js nats.JetStreamContext, clientset *kubernetes.Clientset) { - 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) -} + +// func collectAndPublishMetrics(config *rest.Config, js nats.JetStreamContext, clientset *kubernetes.Clientset) { +// 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) +// } From 853bfe04e0858d669eaeecbc97e2e6b934adfc0a Mon Sep 17 00:00:00 2001 From: Nithunikzz Date: Mon, 18 Mar 2024 13:20:49 +0530 Subject: [PATCH 6/9] Scheduler change for trivy --- agent/kubviz/k8smetrics_agent.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agent/kubviz/k8smetrics_agent.go b/agent/kubviz/k8smetrics_agent.go index ca32d28e..72e5703c 100644 --- a/agent/kubviz/k8smetrics_agent.go +++ b/agent/kubviz/k8smetrics_agent.go @@ -154,7 +154,7 @@ func main() { err = kubescore.RunKubeScore(clientset, js) events.LogErr(err) } - + // collectAndPublishMetrics() if cfg.SchedulerEnable { // Assuming "cfg.Schedule" is a boolean indicating whether to schedule or not. scheduler := scheduler.InitScheduler(config, js, *cfg, clientset) From 4b4f10bb5f254be6fbe68d97f6361f52f2189d8b Mon Sep 17 00:00:00 2001 From: Nithunikzz Date: Mon, 18 Mar 2024 13:30:14 +0530 Subject: [PATCH 7/9] Scheduler change for trivy --- charts/agent/Chart.yaml | 2 +- charts/agent/templates/deployment.yaml | 8 ++++++-- charts/agent/values.yaml | 4 +++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/charts/agent/Chart.yaml b/charts/agent/Chart.yaml index 25cca1a8..296eb7b5 100644 --- a/charts/agent/Chart.yaml +++ b/charts/agent/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 1.1.15 +version: 1.1.16 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/agent/templates/deployment.yaml b/charts/agent/templates/deployment.yaml index db0c1603..675ff272 100644 --- a/charts/agent/templates/deployment.yaml +++ b/charts/agent/templates/deployment.yaml @@ -79,8 +79,12 @@ spec: value: "{{ .Values.schedule.rakkessInterval }}" - name: KUBEPREUPGRADE_INTERVAL value: "{{ .Values.schedule.kubepreupgradeInterval }}" - - name: TRIVY_INTERVAL - value: "{{ .Values.schedule.trivyInterval }}" + - name: TRIVY_IMAGE_INTERVAL + value: "{{ .Values.schedule.trivyimageInterval }}" + - name: TRIVY_SBOM_INTERVAL + value: "{{ .Values.schedule.trivysbomInterval }}" + - name: TRIVY_CLUSTERSCAN_INTERVAL + value: "{{ .Values.schedule.trivyclusterscanInterval }}" - name: IS_OPTEL_ENABLED value: "{{ .Values.opentelemetry.isEnabled }}" - name : OPTEL_URL diff --git a/charts/agent/values.yaml b/charts/agent/values.yaml index 38f991b3..6591ea22 100644 --- a/charts/agent/values.yaml +++ b/charts/agent/values.yaml @@ -184,7 +184,9 @@ schedule: kubescoreInterval: "@every 20h" rakkessInterval: "@every 21h" kubepreupgradeInterval: "@every 22h" - trivyInterval: "@every 24h" + trivyimageInterval: "@every 24h" + trivysbomInterval: "@every 16h" + trivyclusterscanInterval: "@every 17h" kuberhealthy: enabled: true From 74b6de5b44d03b0325e23568b28f0cd6f471abd3 Mon Sep 17 00:00:00 2001 From: Nithunikzz Date: Mon, 25 Mar 2024 10:06:16 +0530 Subject: [PATCH 8/9] changes --- agent/kubviz/k8smetrics_agent.go | 21 +-------------------- agent/kubviz/scheduler/scheduler_watch.go | 21 --------------------- 2 files changed, 1 insertion(+), 41 deletions(-) diff --git a/agent/kubviz/k8smetrics_agent.go b/agent/kubviz/k8smetrics_agent.go index 72e5703c..e31e685b 100644 --- a/agent/kubviz/k8smetrics_agent.go +++ b/agent/kubviz/k8smetrics_agent.go @@ -154,7 +154,7 @@ func main() { err = kubescore.RunKubeScore(clientset, js) events.LogErr(err) } - // collectAndPublishMetrics() + collectAndPublishMetrics() if cfg.SchedulerEnable { // Assuming "cfg.Schedule" is a boolean indicating whether to schedule or not. scheduler := scheduler.InitScheduler(config, js, *cfg, clientset) @@ -180,22 +180,3 @@ func main() { s.StartBlocking() } } - -// func collectAndPublishMetrics(config *rest.Config, js nats.JetStreamContext, clientset *kubernetes.Clientset) { -// 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) -// } diff --git a/agent/kubviz/scheduler/scheduler_watch.go b/agent/kubviz/scheduler/scheduler_watch.go index cadeb462..f2e769af 100644 --- a/agent/kubviz/scheduler/scheduler_watch.go +++ b/agent/kubviz/scheduler/scheduler_watch.go @@ -187,24 +187,3 @@ func (j *RakkessJob) Run() { err := rakkess.RakeesOutput(j.config, j.js) events.LogErr(err) } - -// func NewTrivyJob(config *rest.Config, js nats.JetStreamContext, frequency string) (*TrivyJob, error) { -// return &TrivyJob{ -// config: config, -// js: js, -// frequency: frequency, -// }, nil -// } -// func (v *TrivyJob) CronSpec() string { -// return v.frequency -// } - -// func (j *TrivyJob) Run() { -// // Call the Trivy function with the provided config and js -// err := trivy.RunTrivySbomScan(j.config, j.js) -// events.LogErr(err) -// err = trivy.RunTrivyImageScans(j.config, j.js) -// events.LogErr(err) -// err = trivy.RunTrivyK8sClusterScan(j.js) -// events.LogErr(err) -// } From 2eb36a6aea1fec4ef39896ec254c7618d5f5fe9d Mon Sep 17 00:00:00 2001 From: Nithunikzz Date: Mon, 25 Mar 2024 15:49:45 +0530 Subject: [PATCH 9/9] fix --- agent/kubviz/k8smetrics_agent.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/agent/kubviz/k8smetrics_agent.go b/agent/kubviz/k8smetrics_agent.go index e31e685b..d0c0c7f6 100644 --- a/agent/kubviz/k8smetrics_agent.go +++ b/agent/kubviz/k8smetrics_agent.go @@ -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) @@ -131,7 +131,7 @@ func main() { } }() - //go events.PublishMetrics(clientset, js, clusterMetricsChan) + go events.PublishMetrics(clientset, js, clusterMetricsChan) if cfg.KuberHealthyEnable { go kuberhealthy.StartKuberHealthy(js) }