Coder Social home page Coder Social logo

d-kuro / kubectl-fuzzy Goto Github PK

View Code? Open in Web Editor NEW
154.0 3.0 13.0 3.84 MB

This tool uses fzf(1)-like fuzzy-finder 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.

License: Apache License 2.0

Makefile 0.80% Go 99.20%
go golang kubectl-plugin kubectl-plugins kubectl kubernetes

kubectl-fuzzy's Introduction

kubectl-fuzzy

Fuzzy and partial string search for kubectl

Summary

This tool uses fzf(1)-like fuzzy-finder 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.

๐Ÿ“ Notes

kubectl >= v1.12.0 is required for plugins to work.

For more information on kuberctl plugins see documentation

Install

Krew

Krew is the plugin manager for kubectl command-line tool.

๐Ÿ“ See the documentation for how to install Krew.

kubectl krew update
kubectl krew install fuzzy

Manually

Please download the binaries from the release page.

or

git clone https://github.com/d-kuro/kubectl-fuzzy.git
cd kubectl-fuzzy
make install

Usage

$ kubectl fuzzy -h
Fuzzy Finder kubectl

Usage:
  kubectl-fuzzy
  kubectl-fuzzy [command]

Available Commands:
  create      Create a resource
  delete      Selecting an object with the fuzzy finder and delete
  describe    Selecting an object with the fuzzy finder and show details
  exec        Selecting a Pod with the fuzzy finder and execute a command in a container
  help        Help about any command
  logs        Selecting a Pod with the fuzzy finder and view the log
  version     Show version

Use "kubectl-fuzzy [command] --help" for more information about a command.

Support Commands

  • kubectl logs
  • kubectl exec
  • kubectl describe
  • kubectl create job --from=cronjob
  • kubectl delete
  • anything else...

๐Ÿ“ See the documentation for support commands.

Preview Mode

You can use the --preview or -P option to display a YAML of the Kubernetes object in a fuzzy finder selector. Or you can use environment variables. KUBE_FUZZY_PREVIEW_ENABLED=true You can switch the display to YAML or JSON with the --preview-format option.

e.g.

kubectl fuzzy describe deployment --preview
or
kubectl fuzzy describe deployment -P

The Kubernetes object displayed in the preview window is simplified by default. Some metadata and statuses have been removed. Use the --raw-preview option to display the unsimplified object.

kubectl-fuzzy's People

Contributors

cedrickring avatar d-kuro avatar dependabot-preview[bot] avatar dependabot[bot] avatar khanhtc1202 avatar mpon avatar renovate-bot avatar semihbkgr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

kubectl-fuzzy's Issues

Support for `kubectl get pod`

It would be great if we could run kubectl fuzzy get pod -oyaml and fuzzy select the pod. This seems like a pretty common usecase so I'm curious if there was some strong reason why we didn't already build this

kitty + tmux leads to 'panic: runtime error: index out of range [14] with length 14'

Running any command that invokes the fuzzy selector while in a tmux session on kitty results in a panic. This happens regardless of their configuration settings, I could reproduce it with the defaults.

Interestingly, it works fine in kitty when tmux isn't being used, and it works fine in tmux when it's not running in kitty. It only appears to break when combining the two.

panic: runtime error: index out of range [14] with length 14

goroutine 1 [running]:
github.com/nsf/termbox-go.Close()
        /Users/quinton.cloutier/Library/go/pkg/mod/github.com/nsf/[email protected]/api.go:146 +0x4d2
github.com/ktr0731/go-fuzzyfinder.(*termImpl).close(0x3149d08)
        /Users/quinton.cloutier/Library/go/pkg/mod/github.com/ktr0731/[email protected]/tcell.go:51 +0x25
github.com/ktr0731/go-fuzzyfinder.(*finder).find(0x311a440, 0x21a8200, 0xc000246c18, 0xc0002073e0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /Users/quinton.cloutier/Library/go/pkg/mod/github.com/ktr0731/[email protected]/fuzzyfinder.go:581 +0xc35
github.com/ktr0731/go-fuzzyfinder.(*finder).Find(0x311a440, 0x21a8200, 0xc000246c18, 0xc0002073e0, 0x0, 0x0, 0x0, 0x0, 0xc000537780, 0x100fa38)
        /Users/quinton.cloutier/Library/go/pkg/mod/github.com/ktr0731/[email protected]/fuzzyfinder.go:625 +0x7a
github.com/ktr0731/go-fuzzyfinder.Find(...)
        /Users/quinton.cloutier/Library/go/pkg/mod/github.com/ktr0731/[email protected]/fuzzyfinder.go:621
github.com/d-kuro/kubectl-fuzzy/pkg/fuzzyfinder.Infos(0xc000708a00, 0x20, 0x20, 0xc0005379d8, 0x3, 0x3, 0xcc00266cf50, 0xcc00266d060, 0x100f2db)
        /Users/quinton.cloutier/kubectl-fuzzy/pkg/fuzzyfinder/fuzzyfinder.go:69 +0x267
github.com/d-kuro/kubectl-fuzzy/pkg/cmd.(*LogsOptions).Run(0xc000388340, 0x25f6d00, 0xc000630cc0, 0x0, 0x0)
        /Users/quinton.cloutier/kubectl-fuzzy/pkg/cmd/logs.go:190 +0x3d7
github.com/d-kuro/kubectl-fuzzy/pkg/cmd.NewCmdLogs.func1(0xc0001ab180, 0xc0006340c0, 0x0, 0x1, 0x0, 0x0)
        /Users/quinton.cloutier/kubectl-fuzzy/pkg/cmd/logs.go:50 +0xae
github.com/spf13/cobra.(*Command).execute(0xc0001ab180, 0xc0006340b0, 0x1, 0x1, 0xc0001ab180, 0xc0006340b0)
        /Users/quinton.cloutier/Library/go/pkg/mod/github.com/spf13/[email protected]/command.go:852 +0x472
github.com/spf13/cobra.(*Command).ExecuteC(0xc0001aaf00, 0xc000122000, 0xc000181160, 0x2)
        /Users/quinton.cloutier/Library/go/pkg/mod/github.com/spf13/[email protected]/command.go:960 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
        /Users/quinton.cloutier/Library/go/pkg/mod/github.com/spf13/[email protected]/command.go:897
github.com/spf13/cobra.(*Command).ExecuteContext(...)
        /Users/quinton.cloutier/Library/go/pkg/mod/github.com/spf13/[email protected]/command.go:890
main.run(0x25f6670, 0xc000122000, 0x0, 0x0)
        /Users/quinton.cloutier/kubectl-fuzzy/cmd/kubectl-fuzzy/kubectl-fuzzy.go:36 +0x1f7
main.main()
        /Users/quinton.cloutier/kubectl-fuzzy/cmd/kubectl-fuzzy/kubectl-fuzzy.go:21 +0x3d

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

failed to request: no Auth Provider found for name "gcp"

$ k version
Client Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.9", GitCommit:"a17149e1a189050796ced469dbd78d380f2ed5ef", GitTreeState:"clean", BuildDate:"2020-04-16T11:44:51Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"16+", GitVersion:"v1.16.10-gke.8", GitCommit:"fd29f95f189cb16dd8fe0bd5dc8b485dfd049d2c", GitTreeState:"clean", BuildDate:"2020-06-23T23:44:30Z", GoVersion:"go1.13.9b4", Compiler:"gc", Platform:"linux/amd64"}

image

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.