Skip to content

Commit c0386a4

Browse files
Merge pull request #37 from bhaskaramVaranasi/bhaskaramVaranasi-patch-1
Fix logging for k8s-athenz-syncer
2 parents 9adae96 + 46a037c commit c0386a4

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ require (
2020
k8s.io/api v0.19.15
2121
k8s.io/apimachinery v0.19.15
2222
k8s.io/client-go v0.19.15
23+
k8s.io/klog/v2 v2.2.0 // indirect
2324
)

main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
66
You may obtain a copy of the License at
77
8-
http://www.apache.org/licenses/LICENSE-2.0
8+
http://www.apache.org/licenses/LICENSE-2.0
99
1010
Unless required by applicable law or agreed to in writing, software
1111
distributed under the License is distributed on an "AS IS" BASIS,
@@ -41,6 +41,7 @@ import (
4141
athenzClientset "github.com/yahoo/k8s-athenz-syncer/pkg/client/clientset/versioned"
4242
"github.com/yahoo/k8s-athenz-syncer/pkg/log"
4343
r "github.com/yahoo/k8s-athenz-syncer/pkg/reloader"
44+
"k8s.io/klog/v2"
4445
)
4546

4647
// getClients retrieve the Kubernetes cluster client and Athenz client
@@ -125,6 +126,10 @@ func main() {
125126
header := flag.String("auth-header", "", "Authentication header field")
126127
nTokenExpireTime := flag.String("ntoken-expiry", "1h0m0s", "Custom nToken expiration duration")
127128

129+
klog.InitFlags(nil)
130+
flag.Set("logtostderr", "false")
131+
flag.Set("logtostdout", "false")
132+
flag.Parse()
128133
// create new log
129134
log.InitLogger(*logLoc, *logMode)
130135
// get the Kubernetes and Athenz client for connectivity

0 commit comments

Comments
 (0)