Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1613075

Summary: Significant delay when switching projects
Product: OpenShift Container Platform Reporter: Luke Stanton <lstanton>
Component: ocAssignee: Juan Vallejo <jvallejo>
Status: CLOSED ERRATA QA Contact: Xingxing Xia <xxia>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.6.0CC: aos-bugs, jokerman, jolee, mmccomas, wzheng
Target Milestone: ---   
Target Release: 3.11.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-11 07:24:00 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:

Description Luke Stanton 2018-08-06 23:52:30 UTC
Description of problem:
Project switching is very slow when a large kube config file is being used to track context.

How reproducible:
Consistently.

Steps to Reproduce:
1. Run the 'oc project' command on a machine tracking a large number of contexts in the kube config file

Actual results:
A significant amount of time is required to switch projects.

Expected results:
The project change should happen in a reasonably short amount of time.

Additional info:

Here's an example of the time discrepancy...

--------------------------------------
time oc project op-platform-kit-ci
Now using project "op-platform-kit-ci" on server "https://vh-*****io:8443".

real    0m19.215s
user    0m21.837s
sys     0m0.465s

Compared with:
time oc project op-platform-auth-service
Now using project "op-platform-auth-service" on server "https://vh-*****.io:8443".

real    0m2.242s
user    0m2.521s
sys     0m0.121s
--------------------------------------

Comment 2 Juan Vallejo 2018-08-07 19:02:24 UTC
The reason why this happens, is because we are modifying your kubeconfig any time you switch to a new project [1] in order to update context information. When we do this, we are reading [2] and writing [3] to and from the config file once for _every_ context that you have. This in turn, causes an increasing delay for every context present in your config.

Origin PR: https://github.com/openshift/origin/pull/20566/files

1. https://github.com/openshift/origin/blob/master/pkg/oc/cli/project/project.go#L268

2. https://github.com/kubernetes/client-go/blob/master/tools/clientcmd/config.go#L231

3. https://github.com/kubernetes/client-go/blob/master/tools/clientcmd/config.go#L237

Comment 3 Juan Vallejo 2018-08-14 22:10:02 UTC
Origin PR has merged. Moving to MODIFIED

Comment 5 Xingxing Xia 2018-08-24 03:31:00 UTC
We met this issue in which case the config size is 321K. Verifying with v3.11.0-0.20.0, the issue disappears.

Comment 7 errata-xmlrpc 2018-10-11 07:24:00 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, 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-2018:2652