Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: add a flag to allow prefixing a query in interactive mode #429

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Itaykal
Copy link

@Itaykal Itaykal commented Sep 22, 2024

Behaviour

$ kubectx -q prod

will output:
Screenshot 2024-09-22 at 18 16 59

@ahmetb
Copy link
Owner

ahmetb commented Sep 23, 2024

I'm failing to understand the use case for this. I never needed something like this and fzf does a good job of filtering the same results without introducing a flag with the same amount of keystrokes, no?

@Itaykal
Copy link
Author

Itaykal commented Sep 23, 2024

I'm failing to understand the use case for this. I never needed something like this and fzf does a good job of filtering the same results without introducing a flag with the same amount of keystrokes, no?

Well yes but actually no, I want to be able to create the following aliases:

kx=kubectx -q <staging-context-identifier>
kxp=kubectx -q <production-context-identifier>

And create some "segregation" between context "types", in order to avoid logging in to the wrong cluster

@ahmetb
Copy link
Owner

ahmetb commented Sep 23, 2024

I think you're trying to solve the problem at the wrong layer. I recommend segregating by different kubeconfig files entirely.

Also, this sort of problem won't solve accidents you're trying to prevent. Speaking from experience, a writable context entry is always a recipe for disaster.

At any rate, I don't think this concern should be addressed at this tool, and if you use separate kubeconfig files it would work with this tool with no modifications.

@zcahana
Copy link

zcahana commented Oct 9, 2024

Well yes but actually no, I want to be able to create the following aliases

kx=kubectx -q <staging-context-identifier>
kxp=kubectx -q <production-context-identifier>

@Itaykal if your use case is such aliases, you could achieve something similar via:

kx='FZF_DEFAULT_OPTS="-q <staging-context-identifier>" kubectx'
kxp='FZF_DEFAULT_OPTS="-q <production-context-identifier>" kubectx'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants