Bug 1883461 - Logging is broken due to mix of k8s.io/klog v1 and v2
Summary: Logging is broken due to mix of k8s.io/klog v1 and v2
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Management Console
Version: 4.6
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 4.6.0
Assignee: Jakub Hadvig
QA Contact: Yadan Pei
URL:
Whiteboard:
Depends On:
Blocks: 1885235 1885236 1885237 1886060 1909290
TreeView+ depends on / blocked
 
Reported: 2020-09-29 09:47 UTC by Stefan Schimanski
Modified: 2020-12-18 20:33 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
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
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift console-operator pull 475 0 None closed Bug 1883461: Upgrade to klog v2 2021-02-18 02:35:43 UTC
Red Hat Product Errata RHBA-2020:4196 0 None None None 2020-10-27 16:46:52 UTC

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


Note You need to log in before you can comment on or make changes to this bug.