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

Added hability to switch to a context using a partial name #331

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jordiprats
Copy link

This PR is to be able to switch to the context if only one matches. This is intended for EKS clusters where the default context name is the ARN (arn:aws:eks:REGION:ACCOUNTNUMBER:cluster/CLUSTERNAME) which is quite long but includes the cluster name

@googlebot
Copy link
Collaborator

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@jordiprats
Copy link
Author

@googlebot I signed it!

@googlebot
Copy link
Collaborator

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@ahmetb
Copy link
Owner

ahmetb commented Nov 15, 2021

This did come up in the past and I think (1) it's kinda dangerous as that might not always be the intent and might switch into an unintended context, especially in a non-interactive setting (2) fzf has a builtin flag/feature that does this (I believe "--select-1") (3) we are accepting new changes to the Go implementation at this point (4) there's #324 adding this (with fzf support). That's why I'm inclined to not pursue this.

@jordiprats
Copy link
Author

Would it be this accepted if I add this as a flag?

For example:

kubectl ctx -s example

@ahmetb
Copy link
Owner

ahmetb commented Nov 15, 2021

I think the fzf support already is going to offer this in the PR I linked so I don't think this should be a separate option like -s.

Something like this makes sense only in the interactive context (i.e. not from a script) and in that scenario, we already have a fuzzy search integration with fzf for a long time now and we'll add tools like sk as well (there's an open issue on that too).

So I am inclined to not accept this as a new option or to the bash script. The bash based script is rather small and static , feel free to maintain your fork.

@jordiprats
Copy link
Author

Sure, thank you for your feedback. I don't really like it to be interactive, that's why I have proposed this

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

Successfully merging this pull request may close these issues.

None yet

3 participants