Skip to content

Commit

Permalink
log config
Browse files Browse the repository at this point in the history
  • Loading branch information
ReallyLiri committed Dec 9, 2021
1 parent 3c52bb3 commit ff6956e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
9 changes: 9 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package config

import (
"encoding/json"
"flag"
"fmt"
"github.com/reallyliri/kubescout/internal/kubeconfig"
Expand Down Expand Up @@ -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
}

Expand Down
12 changes: 6 additions & 6 deletions integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() + "")
}
}

Expand Down Expand Up @@ -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()

Expand All @@ -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)

Expand All @@ -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)

Expand All @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion internal/kubeclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"os"
)

const VERSION = "0.1.15"
const VERSION = "0.1.16"

func main() {

Expand Down

0 comments on commit ff6956e

Please sign in to comment.