diff --git a/.goreleaser.yml b/.goreleaser.yml index ab2bb7c..994bc7b 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,10 +1,10 @@ -project_name: resource-status +project_name: status release: github: owner: bergerx - name: kubectl-resource-status + name: kubectl-status builds: - - id: resource-status + - id: status goos: - linux - windows @@ -17,11 +17,11 @@ builds: - GO111MODULE=on main: cmd/plugin/main.go ldflags: -s -w - -X github.com/bergerx/kubectl-resource-status/pkg/version.version= + -X github.com/bergerx/kubectl-status/pkg/version.version= archives: - - id: resource-status + - id: status builds: - - resource-status + - status name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}" format_overrides: - goos: windows diff --git a/Makefile b/Makefile index 0cc473c..df7692e 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ test: .PHONY: bin bin: fmt vet - go build -o bin/resource-status github.com/bergerx/kubectl-resource-status/cmd/plugin + go build -o bin/status github.com/bergerx/kubectl-status/cmd/plugin .PHONY: fmt fmt: diff --git a/README.md b/README.md index b0f3ebf..b217168 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,16 @@ -# resource-status kubectl +# status kubectl A `kubectl` plugin to print a human-friendly output that focuses on the status fields of the resources in kubernetes. -In most cases replacing a `kubectl get ...` with an `kubectl resource-status` +In most cases replacing a `kubectl get ...` with an `kubectl status ...` would be sufficient. ## Quick Start ``` -kubectl krew install resource-status -kubectl resource-status +kubectl krew install status +kubectl status ``` See [usage](doc/USAGE.md) for some sample usage examples. diff --git a/cmd/plugin/cli/root.go b/cmd/plugin/cli/root.go index ab6401b..9570500 100644 --- a/cmd/plugin/cli/root.go +++ b/cmd/plugin/cli/root.go @@ -5,7 +5,7 @@ import ( "os" "strings" - "github.com/bergerx/kubectl-resource-status/pkg/plugin" + "github.com/bergerx/kubectl-status/pkg/plugin" "github.com/spf13/cobra" "github.com/spf13/viper" "k8s.io/cli-runtime/pkg/genericclioptions" @@ -26,9 +26,9 @@ func RootCmd() *cobra.Command { f := cmdutil.NewFactory(KubernetesConfigFlags) cmd := &cobra.Command{ - Use: "kubectl resource-status (TYPE[.VERSION][.GROUP] [NAME | -l label] | TYPE[.VERSION][.GROUP]/NAME ...) [flags]", + Use: "kubectl status (TYPE[.VERSION][.GROUP] [NAME | -l label] | TYPE[.VERSION][.GROUP]/NAME ...) [flags]", //DisableFlagsInUseLine: true, - Short: "Display resource-status for one or many resources", + Short: "Display status for one or many resources", Long: `.`, SilenceErrors: true, SilenceUsage: true, diff --git a/cmd/plugin/main.go b/cmd/plugin/main.go index 3921a66..0b46e0b 100644 --- a/cmd/plugin/main.go +++ b/cmd/plugin/main.go @@ -1,7 +1,7 @@ package main import ( - "github.com/bergerx/kubectl-resource-status/cmd/plugin/cli" + "github.com/bergerx/kubectl-status/cmd/plugin/cli" _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" // required for GKE ) diff --git a/deploy/krew/plugin.yaml b/deploy/krew/plugin.yaml index 926ed21..959d9e7 100644 --- a/deploy/krew/plugin.yaml +++ b/deploy/krew/plugin.yaml @@ -1,50 +1,55 @@ apiVersion: krew.googlecontainertools.github.com/v1alpha2 kind: Plugin metadata: - name: resource-status + name: status spec: - version: "v0.1.0" + version: "v0.2.1" platforms: - selector: matchLabels: os: linux arch: amd64 - uri: https://github.com/bergerx/kubectl-resource-status/releases/download/v0.1.2/resource-status_linux_amd64.tar.gz - sha256: "f441f485cf8984dfdba6dcd3b24a487d32cc8fcc714d2e8abbc16c374647e5e3" + uri: https://github.com/bergerx/kubectl-status/releases/download/v0.1.2/status_linux_amd64.tar.gz + sha256: "ade0777a7fc76b986102e36c70d7e5484dd7e0649131187f6973f8e885ab2c11" files: - - from: "./resource-status" + - from: "./status" to: "." - bin: "resource-status" + - from: LICENCE + to: "." + bin: "status" - selector: matchLabels: os: darwin arch: amd64 - uri: https://github.com/bergerx/kubectl-resource-status/releases/download/v0.1.2/resource-status_darwin_amd64.tar.gz - sha256: "4ae44c0cbabf0cd85249f59af38d1621546c29cc669e49529300520a14123e8c" + uri: https://github.com/bergerx/kubectl-status/releases/download/v0.1.2/status_darwin_amd64.tar.gz + sha256: "848e479388788e859d7d518ca4f4d0f496a8d8f39658e44f96c0411a8690e3de" files: - - from: "./resource-status" + - from: "./status" + to: "." + - from: LICENCE to: "." - bin: "resource-status" + bin: "status" - selector: matchLabels: os: windows arch: amd64 - uri: https://github.com/bergerx/kubectl-resource-status/releases/download/v0.1.2/resource-status_windows_amd64.zip - sha256: "fede11f014ab553a33652733ed70f601c1468f7e085dc48a1822be0abd56ebd5" + uri: https://github.com/bergerx/kubectl-status/releases/download/v1.1.2/status_windows_amd64.zip + sha256: "8fac0f8414e8dfd4b6b6a473c3106deccecac6757f244f5854636efc32bc6ab0" files: - - from: "/resource-status.exe" + - from: "/status.exe" + to: "." + - from: LICENCE to: "." - bin: "resource-status.exe" + bin: "status.exe" shortDescription: Show status details of a given resource. - homepage: https://github.com/bergerx/kubectl-resource-status + homepage: https://github.com/bergerx/kubectl-status caveats: | Usage: - $ kubectl resource-status + $ kubectl status For additional options: - $ kubectl resource-status --help - or https://github.com/bergerx/kubectl-resource-status/blob/v0.1.0/doc/USAGE.md + $ kubectl status --help + or https://github.com/bergerx/kubectl-status/blob/master/doc/USAGE.md description: | - Show status details of a given resource. Doesn't work for all possible - resource types, workload resources are mainly supported. + Show status details of a given resource. Most useful when debugging Pod issues. diff --git a/doc/USAGE.md b/doc/USAGE.md index 82e62e4..721a5b5 100644 --- a/doc/USAGE.md +++ b/doc/USAGE.md @@ -3,21 +3,21 @@ The following assumes you have the plugin installed via ```shell -kubectl krew install resource-status +kubectl krew install status ``` ### Show status of some resources -In most cases replacing a `kubectl get ...` with an `kubectl resource-status` +In most cases replacing a `kubectl get ...` with an `kubectl status` would do it. ```shell -kubectl resource-status pods --all-namespaces # Show status of all pods in all namespaces -kubectl resource-status pods # Show status of all pods in the current namespace -kubectl resource-status nodes # Show status of all nodes -kubectl resource-status pod my-pod # Show status of a particular pod -kubectl resource-status deployment my-dep # Show status of a particular deployment -kubectl resource-status node --selector='node-role.kubernetes.io/master' # Show status of nodes marked as master +kubectl status pods --all-namespaces # Show status of all pods in all namespaces +kubectl status pods # Show status of all pods in the current namespace +kubectl status nodes # Show status of all nodes +kubectl status pod my-pod # Show status of a particular pod +kubectl status deployment my-dep # Show status of a particular deployment +kubectl status node --selector='node-role.kubernetes.io/master' # Show status of nodes marked as master ``` ## How it works diff --git a/go.mod b/go.mod index c092b7a..d6a420a 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/bergerx/kubectl-resource-status +module github.com/bergerx/kubectl-status go 1.12