Bug 1883461

Summary: Logging is broken due to mix of k8s.io/klog v1 and v2
Product: OpenShift Container Platform Reporter: Stefan Schimanski <sttts>
Component: Management ConsoleAssignee: Jakub Hadvig <jhadvig>
Status: CLOSED ERRATA QA Contact: Yadan Pei <yapei>
Severity: high Docs Contact:
Priority: high    
Version: 4.6CC: aos-bugs, jokerman, yapei
Target Milestone: ---   
Target Release: 4.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1883489 1883497 1883502 1883705 1883792 1884028 1884287 1885235 1885236 1885237 1886060 (view as bug list) Environment:
Last Closed: 2020-10-27 16:46:19 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1885235, 1885236, 1885237, 1886060, 1909290    

Description Stefan Schimanski 2020-09-29 09:47:09 UTC
k8s.io/klog moved to v2 in client-go and frieds. The operator does not use v2 yet and hence, we lose one half of the logging output (v2).

Comment 1 Stefan Schimanski 2020-09-29 11:09:06 UTC
I did some tests using openshift-apiserver that uses kube component-base to add klog command line flags:

$ ./openshift-apiserver start --config asfd --v=4
I0929 13:04:18.354425   53628 cmd.go:57] v1 klog
I0929 13:04:18.354506   53628 cmd.go:58] v2 klog
I0929 13:04:18.354512   53628 cmd.go:61] v2 V(2) klog
I0929 13:04:18.354515   53628 cmd.go:64] v2 V(4) klog

So this means that we DO NOT set verbosity for v1 klog, and hence lose all the klogv1.V(2).Infof output.

Comment 4 Yadan Pei 2020-10-10 03:21:44 UTC
1. Create a key/value secret and mount to deployment/console-operator
2. Test 
# oc rsh -n openshift-console-operator console-operator-68ffdfcbb8-rcgd4
sh-4.4$ console operator -v=4 --config=/usr/tmpdata/asfd 
F1010 02:36:29.775834      23 cmd.go:129] json: cannot unmarshal number into Go value of type unstructured.detector
goroutine 1 [running]:
k8s.io/klog/v2.stacks(0xc0001aa001, 0xc0002cc4e0, 0x74, 0xc9)
	/go/src/github.com/openshift/console-operator/vendor/k8s.io/klog/v2/klog.go:996 +0xb9
k8s.io/klog/v2.(*loggingT).output(0x36046a0, 0xc000000003, 0x0, 0x0, 0xc000a0a1c0, 0x3520033, 0x6, 0x81, 0x20ac300)
	/go/src/github.com/openshift/console-operator/vendor/k8s.io/klog/v2/klog.go:945 +0x191
k8s.io/klog/v2.(*loggingT).printDepth(0x36046a0, 0x3, 0x0, 0x0, 0x1, 0xc000135c38, 0x1, 0x1)
	/go/src/github.com/openshift/console-operator/vendor/k8s.io/klog/v2/klog.go:718 +0x165
k8s.io/klog/v2.(*loggingT).print(...)
	/go/src/github.com/openshift/console-operator/vendor/k8s.io/klog/v2/klog.go:703
k8s.io/klog/v2.Fatal(...)
	/go/src/github.com/openshift/console-operator/vendor/k8s.io/klog/v2/klog.go:1443

We can see klog/v2 in the log

Moving to VERIFIED

Client Version: openshift-clients-4.6.0-202006250705.p0-162-g074039a0a
Server Version: 4.6.0-0.nightly-2020-10-09-153352
Kubernetes Version: v1.19.0+d59ce34

Comment 6 errata-xmlrpc 2020-10-27 16:46:19 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (OpenShift Container Platform 4.6 GA Images), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:4196