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

Add fuzzy plugin #660

Merged
merged 5 commits into from
Jul 1, 2020
Merged

Add fuzzy plugin #660

merged 5 commits into from
Jul 1, 2020

Conversation

d-kuro
Copy link
Contributor

@d-kuro d-kuro commented Jun 20, 2020

This PR aims to add fuzzy plugin to krew index.

This plugin is a kubectl plugin providing a fuzzy finder selector.

There is a tool of the same name, but it is not kubectl plugin, so I thought it was OK.
https://github.com/bonnefoa/kubectl-fzf

I'm open to suggestions about the problem.
Thanks!

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 20, 2020
@k8s-ci-robot
Copy link
Contributor

Welcome @d-kuro!

It looks like this is your first PR to kubernetes-sigs/krew-index 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/krew-index has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 20, 2020
@d-kuro d-kuro changed the title Add fzf plugin [WIP] Add fzf plugin Jun 20, 2020
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 20, 2020
@d-kuro d-kuro changed the title [WIP] Add fzf plugin Add fzf plugin Jun 20, 2020
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 20, 2020
@ahmetb
Copy link
Member

ahmetb commented Jun 20, 2020

I don’t think it will be wise to assign the fzf name:

  1. fzf project already exists
  2. There are other plugins named fzf (https://github.com/bonnefoa/kubectl-fzf) what if they come and ask us to add their plugin (we don’t want to have first-comer advantage)

@d-kuro
Copy link
Contributor Author

d-kuro commented Jun 20, 2020

@ahmetb

Thank you comments.
Hmm.., I understand. I think you're right.

For example, what if you renamed kubectl-fzf to kubectl-fuzzyfinder?
I liked the short name fzf, but I'm considering renaming the project.

@ahmetb
Copy link
Member

ahmetb commented Jun 22, 2020

I think even fuzzy could work. I’ll defer to @corneliusweig.

@corneliusweig
Copy link
Contributor

Yeah, fzf is pretty much a trademark in the open source world. I think people would be confused to find that your plugin isn't the real fzf.
fuzzy sounds pretty good to me.

@d-kuro
Copy link
Contributor Author

d-kuro commented Jun 24, 2020

@ahmetb @corneliusweig
Thank you!
I will rename the project to kubecl-fuzzy based on your advice.

I will modify this Pull Request after I have renamed the project and made a release.

@d-kuro
Copy link
Contributor Author

d-kuro commented Jun 25, 2020

@ahmetb @corneliusweig

I renamed the project and fixed the Pull Request.
Please review 🙏

@d-kuro d-kuro changed the title Add fzf plugin Add fuzzy plugin Jun 25, 2020
Copy link
Contributor

@corneliusweig corneliusweig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please help me understand what your plugin really does. I'm not entirely sure from the description.

I do have concerns, if it's main purpose is to select an individual pod by fuzzy matching its name.

os: windows
arch: amd64
version: "v1.0.1"
shortDescription: Fuzzy Finder Pod selector plugin. Currently "kubectl logs" and "kubectl exec" are supported.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please find a more succinct description for you plugin. Anything above ~50 chars gets usually truncated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, Thanks!
6eddc7e

shortDescription: Fuzzy Finder Pod selector plugin. Currently "kubectl logs" and "kubectl exec" are supported.
description: |
Kubectl fuzzy is a kubectl plugin providing a Fuzzy Finder Pod selector.
Uses go-fuzzyfinder, so there is no dependency on fzf binaries or anything else.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an implementation detail and can safely be skipped in the description. I think it's better to be mentioned on the project homepage.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the description.
6eddc7e

version: "v1.0.1"
shortDescription: Fuzzy Finder Pod selector plugin. Currently "kubectl logs" and "kubectl exec" are supported.
description: |
Kubectl fuzzy is a kubectl plugin providing a Fuzzy Finder Pod selector.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear to me what this plugin actually does. Is it really just for selecting pods by a fuzzy pattern? If that is indeed the case, I think this is not the right approach. The recommended way to select pods in Kubernetes is via labels. Selecting individual pods via fuzzy match seems pretty wonky to me.

My original assumption was that this plugin does some fuzzy magic on the output of some kubectl commands. Apparently, I misread this :/

FWIW, there are already a few plugins which focus on exec and logs commands. For example https://github.com/gabeduke/kubectl-iexec, https://gitlab.com/grzesuav/kubectl-mtail, https://github.com/boz/kail and probably more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the comment. I will fix the tool description.

That's right, you can select an object in the label selector.
But in order to use the label selector, you need to know which label is being used on the target Kubernetes object.
I was too lazy to look up labels, so I decided to create this tool.
A fuzzy search allows you to select an object without having to find out which label is used for the Kubernetes object.

As for exec and logs, I know there are other tools for interactively selecting pods, but I think that fuzzy searches differentiate them from other tools.

I have also added support for kubectl describe yesterday.
I'm going to add more features to this tool in the future.
https://github.com/d-kuro/kubectl-fuzzy/releases/tag/v1.1.0

@ahmetb
Copy link
Member

ahmetb commented Jun 27, 2020

I recommend installing and trying out.
It seems the main use case is to type for example “kubectl fuzzy describe pods” and then use fzf to type a few chars to do fuzzy string match. This isn’t like a label selector, maybe the description is not great.

@ahmetb
Copy link
Member

ahmetb commented Jun 30, 2020

@corneliusweig Ping for the comment above.

os: windows
arch: amd64
version: "v1.2.0"
shortDescription: Fuzzy Finder Kubernetes object selector plugin.
Copy link
Member

@ahmetb ahmetb Jul 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still not good. You should consider never using the word selector. It has a specific meaning in Kubernetes that is causing all the misunderstanding w/ @corneliusweig and it will confuse users too.

You should update your repo and help messages ideally but here's my attempt at writing your description:

Fuzzy and partial string search for kubectl

full description:

This tool uses fzf(1) to do partial or fuzzy search of Kubernetes resources. Instead of specifying full resource names to kubectl commands, you can choose them from an interactive list that you can filter by typing a few characters.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the advice.
I think the description you have come up with is smart!

I'm sorry if I sound picky.
Strictly speaking, I use a different implementation of fuzzy finder than github.com/junegunn/fzf, so I'd like to rephrase it to fzf-like.

This tool uses a fzf(1)-like fuzzy-finder to do partial or fuzzy search of Kubernetes resources.

I will fix it. (at the same time, I will fix the repository README)

Co-authored-by: d-kuro <kurosawa7620@gmail.com>
@ahmetb
Copy link
Member

ahmetb commented Jul 1, 2020

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 1, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahmetb, d-kuro

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 1, 2020
@k8s-ci-robot k8s-ci-robot merged commit bbb11f9 into kubernetes-sigs:master Jul 1, 2020
@d-kuro d-kuro deleted the feature/fzf branch July 1, 2020 18:52
@d-kuro
Copy link
Contributor Author

d-kuro commented Jul 1, 2020

@ahmetb Thanks for your support!

@corneliusweig
Copy link
Contributor

Sorry for being such a 🐌.. and too late for the 🎉
I think you are taking the plugin in a great direction. After having a better look at it, this makes total sense and I think this is a great addition to the index! Looking forward to your next features!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants