diff --git a/config/config.go b/config/config.go index 587b09f..1f22997 100644 --- a/config/config.go +++ b/config/config.go @@ -1,6 +1,7 @@ package config import ( + "encoding/json" "flag" "fmt" "github.com/reallyliri/kubescout/internal/kubeconfig" @@ -281,6 +282,14 @@ func ParseConfig(c *cli.Context) (*Config, error) { } } + if log.GetLevel() >= log.DebugLevel { + configJson, err := json.MarshalIndent(config, "", " ") + if err != nil { + log.Errorf("failed to serialize config to json: %v", err) + } + log.Debugf("Loaded config:\n%v", string(configJson)) + } + return config, nil } diff --git a/integration_test.go b/integration_test.go index 39f60c6..342b78d 100644 --- a/integration_test.go +++ b/integration_test.go @@ -123,10 +123,10 @@ func (s *verifySink) Report(alerts *alert.Alerts) error { } func cleanUp() { - log.Infof("cleaning up namespace ...\n") + log.Infof("cleaning up namespace ...") err := cleanupDefaultNamespace() if err != nil { - log.Error(err.Error() + "\n") + log.Error(err.Error() + "") } } @@ -164,7 +164,7 @@ func TestIntegration(t *testing.T) { err = applyManifests() require.Nil(t, err) - log.Infof("set up completed, sleeping to give namespace time to stabilize ...\n") + log.Infof("set up completed, sleeping to give namespace time to stabilize ...") defer cleanUp() @@ -174,7 +174,7 @@ func TestIntegration(t *testing.T) { vSink := &verifySink{} - log.Infof("running 1/3 diagnose call ...\n") + log.Infof("running 1/3 diagnose call ...") err = pkg.Scout(cfg, vSink) require.Nil(t, err) @@ -188,7 +188,7 @@ func TestIntegration(t *testing.T) { require.Nil(t, err) require.NotEmpty(t, storeContent) - log.Infof("running 2/3 diagnose call ...\n") + log.Infof("running 2/3 diagnose call ...") err = pkg.Scout(cfg, vSink) require.Nil(t, err) @@ -203,7 +203,7 @@ func TestIntegration(t *testing.T) { log.Infof("sleeping to get de-dup grace time to pass") time.Sleep(time.Minute) - log.Infof("running 3/3 diagnose call ...\n") + log.Infof("running 3/3 diagnose call ...") err = pkg.Scout(cfg, vSink) require.Nil(t, err) diff --git a/internal/kubeclient/client.go b/internal/kubeclient/client.go index 1e8b48f..a00b86b 100644 --- a/internal/kubeclient/client.go +++ b/internal/kubeclient/client.go @@ -47,7 +47,7 @@ func CreateClient(config *config.Config, kubeconfig kubeconfig.KubeConfig) (Kube } } else { kubeconfigFilePath := config.KubeconfigFilePath - log.Debugf("Building kubernetes client from kubeconfig '%v'\n", kubeconfigFilePath) + log.Debugf("Building kubernetes client from kubeconfig '%v'", kubeconfigFilePath) kconf, err = clientcmd.BuildConfigFromKubeconfigGetter("", func() (*clientcmdapi.Config, error) { return kubeconfig, nil }) diff --git a/main.go b/main.go index 0c90566..03fc267 100644 --- a/main.go +++ b/main.go @@ -9,7 +9,7 @@ import ( "os" ) -const VERSION = "0.1.15" +const VERSION = "0.1.16" func main() {