kubectl-view-utilization icon indicating copy to clipboard operation
kubectl-view-utilization copied to clipboard

`kubectl view-utilization` broken

Open JJJJJones opened this issue 4 years ago • 2 comments

Describe the bug Kubectl plugin naming conventions dictates that anything hyphen-separated is a subcommand so kubectl-view-utilization should be called like kubectl view utilization and not kubectl view-utilization.

sh-4.2# kubectl plugin list
The following compatible plugins are available:

/usr/local/bin/kubectl-grep
/usr/local/bin/kubectl-ingress_nginx
/usr/local/bin/kubectl-view-utilization
sh-4.2# kubectl-view-utilization -v
v0.3.2
sh-4.2# kubectl view utilization
The connection to the server localhost:8080 was refused - did you specify the right host or port?
The connection to the server localhost:8080 was refused - did you specify the right host or port?
Resource  Requests  %Requests  Limits  %Limits  Allocatable  Schedulable  Free
CPU                       Err              Err                         0     0
Memory           0        Err              Err            0            0     0
sh-4.2# kubectl view-utilization
Error: unknown command "view-utilization" for "kubectl"
Run 'kubectl --help' for usage.
sh-4.2#

System details

  • Operating system that client is running MacOS 10.15.3, CentOS7/8, Docker 2.2.0.4
  • kubectl client and server version kubectl version 1.16.6
  • view-utilization plugin version kubectl view-utilization -v kubectl view-utilization -v is precisely what doesn't work :) but its v0.3.2

JJJJJones avatar Apr 02 '20 16:04 JJJJJones

@JJJJJones thank you for submitting issue. Can you please share how did you install this plugin? There are 3 ways to install this plugin described in Readme.md

  1. Krew plugin manager
  2. Curl download
  3. Brew package manager

Instructions in Readme.md call to move file view-utilization to kubectl-view_utilization if you use curl method.

Brew method is doing it for you: https://github.com/etopeter/homebrew-tap/blob/master/kubectl-view-utilization.rb#L11

Name also adheers to krew plugin naming convention where they require to use - between words (https://krew.sigs.k8s.io/docs/developer-guide/develop/naming-guide/) . It does convert kubectl-view-utilization to kubectl-view_utilization during installation process. The actual name of this plugin was inspired by krew plugin maintainer as it was called only utilization when I first submitted it to krew-index. There are other plugins with view prefix and that's why I added view-utilization to the name.

etopeter avatar Apr 02 '20 22:04 etopeter

Ah, i'm using the cURL method is why! I'll automate the rename.

Why not just have it as kubectl-view_utilization always?

Name also adheers to krew plugin naming convention where they require to use - between words (https://krew.sigs.k8s.io/docs/developer-guide/develop/naming-guide/).

While the rest of the conventions are okayish, using a hyphen always is an inflexible naming scheme that doesn't work the best when kubectl-view_utilization isn't a subcommand of kubectl view.

JJJJJones avatar Apr 03 '20 16:04 JJJJJones