From 4c5bbadf07e80ed7d29cba8ab7386669ec06e2c8 Mon Sep 17 00:00:00 2001 From: Martin Linkhorst Date: Tue, 13 Aug 2019 13:17:46 +0200 Subject: [PATCH] fix: avoid writing klogs to the filesystem --- go.mod | 1 + main.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/go.mod b/go.mod index 7eed77bc..e2ae79f8 100644 --- a/go.mod +++ b/go.mod @@ -15,5 +15,6 @@ require ( k8s.io/api v0.0.0-20190620084959-7cf5895f2711 k8s.io/apimachinery v0.0.0-20190612205821-1799e75a0719 k8s.io/client-go v0.0.0-20190620085101-78d2af792bab + k8s.io/klog v0.3.1 k8s.io/utils v0.0.0-20190607212802-c55fbcfc754a // indirect ) diff --git a/main.go b/main.go index 0a617315..0047cc46 100644 --- a/main.go +++ b/main.go @@ -3,6 +3,7 @@ package main import ( "context" "fmt" + "io/ioutil" "math/rand" "net/http" _ "net/http/pprof" @@ -22,6 +23,7 @@ import ( "k8s.io/client-go/kubernetes" _ "k8s.io/client-go/plugin/pkg/client/auth" "k8s.io/client-go/tools/clientcmd" + "k8s.io/klog" "github.com/linki/chaoskube/chaoskube" "github.com/linki/chaoskube/terminator" @@ -57,6 +59,7 @@ var ( func init() { rand.Seed(time.Now().UTC().UnixNano()) + klog.SetOutput(ioutil.Discard) kingpin.Flag("labels", "A set of labels to restrict the list of affected pods. Defaults to everything.").StringVar(&labelString) kingpin.Flag("annotations", "A set of annotations to restrict the list of affected pods. Defaults to everything.").StringVar(&annString)