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

Broken kubectl completion with override flags #80797

Closed
tatsuhiro-t opened this issue Jul 31, 2019 · 3 comments · Fixed by #80802
Closed

Broken kubectl completion with override flags #80797

tatsuhiro-t opened this issue Jul 31, 2019 · 3 comments · Fixed by #80802
Labels
kind/bug Categorizes issue or PR as related to a bug. sig/cli Categorizes an issue or PR as relevant to SIG CLI.

Comments

@tatsuhiro-t
Copy link
Contributor

What happened:

With kubectl v1.16.0-alpha.2, completion with override flags fails.
kubectl --kubeconfig=foo -n then hit TAB will produce error "resource type must be specified"

What you expected to happen:

It must show the namespaces without error.

How to reproduce it (as minimally and precisely as possible):

With kubectl v1.16.0-alpha.2, kubectl --kubeconfig=foo -n then hit TAB key.

Anything else we need to know?:

It looks like #70470 introduced this regression.

Environment:

  • Kubernetes version (use kubectl version): kubectl v1.16.0-alpha.2
  • Cloud provider or hardware configuration:
  • OS (e.g: cat /etc/os-release):
  • Kernel (e.g. uname -a):
  • Install tools:
  • Network plugin and version (if this is a network-related bug):
  • Others:
@tatsuhiro-t tatsuhiro-t added the kind/bug Categorizes issue or PR as related to a bug. label Jul 31, 2019
@k8s-ci-robot k8s-ci-robot added the needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. label Jul 31, 2019
@tatsuhiro-t
Copy link
Contributor Author

/sig cli

@k8s-ci-robot k8s-ci-robot added sig/cli Categorizes an issue or PR as relevant to SIG CLI. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jul 31, 2019
@superbrothers
Copy link
Member

I also reproduced this bug with the following steps:

$ bash --version
GNU bash, version 4.4.12(1)-release (x86_64-apple-darwin15.6.0)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ git checkout 978c38d488e6339aa294aa28b084f9c9626f83ab
Previous HEAD position was 79aab0b90d... Merge pull request #78246 from mborsz/kubemark
HEAD is now at 978c38d488... Merge pull request #70470 from dtaniwaki/fix-auto-completion
$ make kubectl
+++ [0731 17:57:47] Building go targets for darwin/amd64:
    cmd/kubectl
$ _output/bin/kubectl version
Client Version: version.Info{Major:"1", Minor:"16+", GitVersion:"v1.16.0-alpha.0.2059+978c38d488e633-dirty", GitCommit:"978c38d488e6339aa294aa28b084f9c9626f83ab", GitTreeState:"dirty", BuildDate:"2019-07-31T08:57:47Z", GoVersion:"go1.12.6", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.4", GitCommit:"a87e9a978f65a8303aa9467537aa59c18122cbf9", GitTreeState:"clean", BuildDate:"2019-07-08T08:43:10Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
$ . "/usr/local/etc/profile.d/bash_completion.sh"
$ source <(_output/bin/kubectl completion bash)
$ kubectl --kubeconfig ./kubeconfig -n You must specify the type of resource to get. Use "kubectl api-resources" for a complete list of supported resources.

error: Required resource not specified.
Use "kubectl explain <resource>" for a detailed description of that resource (e.g. kubectl explain pods).
See 'kubectl get -h' for help and examples

Error: flag needs an argument: 'n' in -n
(...)

@dtaniwaki
Copy link
Contributor

I'm fixing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. sig/cli Categorizes an issue or PR as relevant to SIG CLI.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants