From 18a9ac3d6e6ad7b162078584d62a02092cf7fb3e Mon Sep 17 00:00:00 2001 From: David Wertenteil Date: Fri, 13 Jan 2023 13:26:36 +0200 Subject: [PATCH 1/2] adding debug logs --- core/pkg/hostsensorutils/hostsensordeploy.go | 1 + core/pkg/policyhandler/handlenotification.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/core/pkg/hostsensorutils/hostsensordeploy.go b/core/pkg/hostsensorutils/hostsensordeploy.go index faf21aa6..ecadf350 100644 --- a/core/pkg/hostsensorutils/hostsensordeploy.go +++ b/core/pkg/hostsensorutils/hostsensordeploy.go @@ -75,6 +75,7 @@ func (hsh *HostSensorHandler) Init() error { // store pod names // make sure all pods are running, after X seconds treat has running anyway, and log an error on the pods not running yet logger.L().Info("Installing host scanner") + logger.L().Debug("The host scanner is a DaemonSet that runs on each node in the cluster. The DaemonSet will be running in it's own namespace and will be deleted once the scan is completed. If you do not wish to install the host scanner, please run the scan without the --enable-host-scan flag.") cautils.StartSpinner() diff --git a/core/pkg/policyhandler/handlenotification.go b/core/pkg/policyhandler/handlenotification.go index 6c797bf4..c40f37e6 100644 --- a/core/pkg/policyhandler/handlenotification.go +++ b/core/pkg/policyhandler/handlenotification.go @@ -4,6 +4,8 @@ import ( "fmt" "strings" + logger "github.com/kubescape/go-logger" + "github.com/kubescape/go-logger/helpers" helpersv1 "github.com/kubescape/opa-utils/reporthandling/helpers/v1" clientcmdapi "k8s.io/client-go/tools/clientcmd/api" @@ -94,6 +96,8 @@ func setCloudMetadata(opaSessionObj *cautils.OPASessionObj) { opaSessionObj.Metadata.ContextMetadata.ClusterContextMetadata.CloudMetadata = cloudMetadata opaSessionObj.Metadata.ClusterMetadata.CloudMetadata = cloudMetadata // deprecated - fallback opaSessionObj.Report.ClusterCloudProvider = iCloudMetadata.Provider().ToString() // deprecated - fallback + + logger.L().Debug("Cloud metadata", helpers.String("provider", iCloudMetadata.Provider().ToString()), helpers.String("name", iCloudMetadata.GetName())) } // getCloudMetadata - get cloud metadata from kubeconfig or API server From 0c06b6c3e6f1c2b3ba4f91c6a934621246bbd3a8 Mon Sep 17 00:00:00 2001 From: David Wertenteil Date: Fri, 13 Jan 2023 13:27:05 +0200 Subject: [PATCH 2/2] enable `--create-account` flag --- cmd/scan/scan.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/scan/scan.go b/cmd/scan/scan.go index ac87f2e7..fe1b2796 100644 --- a/cmd/scan/scan.go +++ b/cmd/scan/scan.go @@ -66,7 +66,7 @@ func GetScanCommand(ks meta.IKubescape) *cobra.Command { } scanCmd.PersistentFlags().StringVarP(&scanInfo.Credentials.Account, "account", "", "", "Kubescape SaaS account ID. Default will load account ID from cache") - // scanCmd.PersistentFlags().BoolVar(&scanInfo.CreateAccount, "create-account", false, "Create a Kubescape SaaS account ID account ID is not found in cache. After creating the account, the account ID will be saved in cache. In addition, the scanning results will be uploaded to the Kubescape SaaS") + scanCmd.PersistentFlags().BoolVar(&scanInfo.CreateAccount, "create-account", false, "Create a Kubescape SaaS account ID account ID is not found in cache. After creating the account, the account ID will be saved in cache. In addition, the scanning results will be uploaded to the Kubescape SaaS") scanCmd.PersistentFlags().StringVarP(&scanInfo.Credentials.ClientID, "client-id", "", "", "Kubescape SaaS client ID. Default will load client ID from cache, read more - https://hub.armosec.io/docs/authentication") scanCmd.PersistentFlags().StringVarP(&scanInfo.Credentials.SecretKey, "secret-key", "", "", "Kubescape SaaS secret key. Default will load secret key from cache, read more - https://hub.armosec.io/docs/authentication") scanCmd.PersistentFlags().StringVarP(&scanInfo.KubeContext, "kube-context", "", "", "Kube context. Default will use the current-context")