Code Monkey home page Code Monkey logo

Comments (6)

edgan avatar edgan commented on June 10, 2024

Bash - slow:
https://github.com/ahmetb/kubectx/releases/download/v0.9.5/kubectx

Native binary - fast:
https://github.com/ahmetb/kubectx/releases/download/v0.9.5/kubectx_v0.9.5_darwin_arm64.tar.gz

from kubectx.

ahmetb avatar ahmetb commented on June 10, 2024

Before we go into Bash vs Go implementations, I assume you use the bash script-based implementation?

Does "kubectl config list-contexts" also take 3s?

If that's the case let's try to figure out why, as it'll impact your shell completion time regardless of kubectx implementation.

from kubectx.

edgan avatar edgan commented on June 10, 2024

I couldn't find kubectl config list-contexts, but did find kubectl config get-contexts. kubectl config get-contexts was slow. I found I was using kubectl from rancher-desktop. When I moved rancher-desktop's bin directory from the beginning of the PATH to the end up the PATH it became fast. The reason is that I was then using kubectl from brew.

Update: Upgrading rancher-desktop helped by 100%, but its kubectl is still between 280% slower and 600% slower.

from kubectx.

ahmetb avatar ahmetb commented on June 10, 2024

Kubectl shouldn't take a second to list contexts. Feel free to add -v=10 flag to see where the time is spent. Regardless, it doesn't seem the issue is with this tool.

If it turns out kubectl is unnecessarily slow, you can file an issue in kubectl repo. It might be a regression.

from kubectx.

edgan avatar edgan commented on June 10, 2024

@ahmetb My question is why have a bash version and a native binary version? I could make arguments for both, but having both seems redundant.

from kubectx.

ahmetb avatar ahmetb commented on June 10, 2024

@edgan this is not really the place to debate that :) many distros still package and distribute the shell version.

Go version works on Windows, and has some other benefits like it can preserve kubeconfig file structure/comments while changing contexts. But it has some poor handling around multiple KUBECONFIGs joined (:) and auth providers that write back to kubeconfig file after authentication.

So for some users the shell has the most backwards compatibility as it shells out to kubectl. Whereas most users are probably fine with Go implementation.

from kubectx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.