From 95e68f49f39ac9bd9e8271607db99b31791b3496 Mon Sep 17 00:00:00 2001 From: David Wertenteil Date: Tue, 24 May 2022 09:33:40 +0300 Subject: [PATCH] do not submit results every scan with Prometheus --- httphandler/handlerequests/v1/prometheus.go | 1 + httphandler/handlerequests/v1/requestshandlerutils.go | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/httphandler/handlerequests/v1/prometheus.go b/httphandler/handlerequests/v1/prometheus.go index 6a3f18fe..1ab250a3 100644 --- a/httphandler/handlerequests/v1/prometheus.go +++ b/httphandler/handlerequests/v1/prometheus.go @@ -64,6 +64,7 @@ func (handler *HTTPHandler) Metrics(w http.ResponseWriter, r *http.Request) { func getPrometheusDefaultScanCommand(scanID, resultsFile string) *cautils.ScanInfo { scanInfo := defaultScanInfo() + scanInfo.Local = true // do not submit results every scan scanInfo.FrameworkScan = true scanInfo.ScanAll = true // scan all frameworks scanInfo.ScanID = scanID // scan ID diff --git a/httphandler/handlerequests/v1/requestshandlerutils.go b/httphandler/handlerequests/v1/requestshandlerutils.go index cd98793f..106c7285 100644 --- a/httphandler/handlerequests/v1/requestshandlerutils.go +++ b/httphandler/handlerequests/v1/requestshandlerutils.go @@ -138,14 +138,14 @@ func defaultScanInfo() *cautils.ScanInfo { scanInfo := &cautils.ScanInfo{} scanInfo.FailThreshold = 100 scanInfo.Account = envToString("KS_ACCOUNT", "") // publish results to Kubescape SaaS - scanInfo.ExcludedNamespaces = envToString("KS_EXCLUDE_NAMESPACES", "") // namespace to exclude - scanInfo.HostSensorYamlPath = envToString("KS_HOST_SCAN_YAML", "") // namespace to exclude - scanInfo.IncludeNamespaces = envToString("KS_INCLUDE_NAMESPACES", "") // namespace to include + scanInfo.ExcludedNamespaces = envToString("KS_EXCLUDE_NAMESPACES", "") // namespaces to exclude + scanInfo.IncludeNamespaces = envToString("KS_INCLUDE_NAMESPACES", "") // namespaces to include + scanInfo.HostSensorYamlPath = envToString("KS_HOST_SCAN_YAML", "") // path to host scan YAML scanInfo.FormatVersion = envToString("KS_FORMAT_VERSION", "v2") // output format version scanInfo.Format = envToString("KS_FORMAT", "json") // default output should be json scanInfo.Submit = envToBool("KS_SUBMIT", false) // publish results to Kubescape SaaS - scanInfo.HostSensorEnabled.SetBool(envToBool("KS_ENABLE_HOST_SCANNER", false)) // enable host scanner scanInfo.Local = envToBool("KS_KEEP_LOCAL", false) // do not publish results to Kubescape SaaS + scanInfo.HostSensorEnabled.SetBool(envToBool("KS_ENABLE_HOST_SCANNER", false)) // enable host scanner if !envToBool("KS_DOWNLOAD_ARTIFACTS", false) { scanInfo.UseArtifactsFrom = getter.DefaultLocalStore // Load files from cache (this will prevent kubescape fom downloading the artifacts every time) }