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 --------------------------------------
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
Origin PR has merged. Moving to MODIFIED
We met this issue in which case the config size is 321K. Verifying with v3.11.0-0.20.0, the issue disappears.
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