File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package main
2
2
3
3
import (
4
4
"encoding/json"
5
+ "flag"
5
6
"log"
6
7
"os"
7
8
@@ -12,7 +13,13 @@ import (
12
13
"k8s.io/client-go/tools/clientcmd"
13
14
)
14
15
16
+ var (
17
+ ignoreNormal = flag .Bool ("ignore-normal" , false , "ignore events of type 'Normal' to reduce noise" )
18
+ )
19
+
15
20
func main () {
21
+ flag .Parse ()
22
+
16
23
loggerApplication := log .New (os .Stderr , "" , log .LstdFlags )
17
24
loggerEvent := log .New (os .Stdout , "" , 0 )
18
25
@@ -51,6 +58,9 @@ func main() {
51
58
0 ,
52
59
cache.ResourceEventHandlerFuncs {
53
60
AddFunc : func (obj interface {}) {
61
+ if (* ignoreNormal && obj .(* corev1.Event ).Type == corev1 .EventTypeNormal ) {
62
+ return
63
+ }
54
64
j , _ := json .Marshal (obj )
55
65
loggerEvent .Printf ("%s\n " , string (j ))
56
66
},
You can’t perform that action at this time.
0 commit comments