Bug 1326569

Summary: User login will take time to load kube config repeatly way too many times.
Product: OpenShift Container Platform Reporter: XiaochuanWang <xiaocwan>
Component: ocAssignee: Maciej Szulik <maszulik>
Status: CLOSED EOL QA Contact: Wei Sun <wsun>
Severity: low Docs Contact:
Priority: medium    
Version: 3.2.0CC: aos-bugs, deads, jokerman, mmccomas, trankin, wsun
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-08-21 08:41:43 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:

Description XiaochuanWang 2016-04-13 05:55:23 UTC
Created attachment 1146701 [details]
login_ose.log

Description of problem:
When user login, it'll load config way too many times.

Version-Release number of selected component (if applicable):
oc v3.2.0.14
openshift v3.2.0.14
kubernetes v1.2.0-36-g4a3f9c5

How reproducible:
Always

Steps to Reproduce:
oc login with loglevel=8 and check

Actual results:
It'll take a while to load config over again and again. Log shows as below:
I0413 13:04:12.645794    6295 loader.go:242] Config loaded from file /root/.kube/config

Refer to "login_ose.log"

Expected results:
Shouldn't be so many times to load config

Additional info:
From origin: "login_origin.log"

Comment 1 XiaochuanWang 2016-04-13 05:56:40 UTC
Created attachment 1146702 [details]
login_origin.log

Comment 2 XiaochuanWang 2016-04-13 09:23:50 UTC
The way it reproduced is there are so many content on local .kube/config. Will not reproduced if clear the config.

Comment 3 weiwei jiang 2016-04-13 10:03:40 UTC
Looks like the code(https://github.com/openshift/origin/blob/388478c40e751c4295dcb9a44dd69e5ac65d0e3b/pkg/cmd/cli/cmd/loginoptions.go#L235) will load multiple time for the for loop on the contexts.


And better move the following logic out of the for loops:
clientcmdConfig := kclientcmd.NewDefaultClientConfig(kubeconfig, &kclientcmd.ConfigOverrides{CurrentContext: key})
				if kubeconfigClientConfig, err := clientcmdConfig.ClientConfig(); err == nil {

Comment 4 Maciej Szulik 2019-08-21 08:41:43 UTC
Closing due to age, also it was addressed in one of the later releases.