Change:
TODOs: Last updated on Sept 2 by Janet [x] kubectl label - suggest a resource type [x] kubectl get and delete also use kubectl.NewHumanReadablePrinter to get the resources back, thus should be fixed as well. [x] kubectl exec - suggest the pod name [x] kubectl rolling-update - suggest the rc name [x] check that is doing the right thing [x] Distribute with kubernetes binaries [x] Put information about kubectl completion in user guide [x] docs/getting-started- Recently some users reported that there is no completion for the kubectl command. But there is. Unfortunately it is not documented how to install it. I found that all needs to be done is to: (or maybe just copy this file into /etc/bash_completion.d/) This information should be put into the user guide (maybe it is there - I just can't find it) I think it should be included for instance here: docs/getting-started- There are also some minor issues: does not suggest the rc name does not suggest the pod name does not suggest a resource type (maybe this is ok because we can give --overwrite here)
It looks like the bash-completion file is not distributed with kubernetes binaries:
:+1: This should definitely be provided with the binaries.
Good suggestions. Cc
, please cofirm that the bash completion file is distributed with k8s binaries: namely contrib/completions/bash/kubectl For me it looks like it isn't.
cc
I confirmed and it isn't.
TODOs: [x] kubectl label - suggest a resource type [x] kubectl get and delete also use kubectl.NewHumanReadablePrinter to get the resources back, thus should be fixed as well. [x] kubectl exec - suggest the pod name [x] kubectl rolling-update - suggest the rc name [x] check that is doing the right thing [x] Distribute with kubernetes binaries [x] Put information about kubectl completion in user guide [x] docs/getting-started- Last updated on Sept 2
Maybe add: check that is doing the right thing....
Thanks for the suggestion. Checklist updated.
Depending on where you want it in the tarball, is a good place to start. You can use and then iterate on until you're comfortable with the changes. (If I'm making packaging changes, I'll frequently start by dumping the sorted output of that command into a file, then later diff against it to make sure I got exactly the change I wanted.)
Right now both and brings up all containers that has. Since is optional (the without -c way is supported as legacy behavior), this is expected. I'm not sure how to force the bash completion to print instead of container names when since flag isn't set as required in code.

Discussion:
__kubectl_parse_get "${nouns[${#nouns[@]} -1]}" } <ins> __kubectl_get_resource_pod() { __kubectl_parse_get "pod" } </ins> # $1 is the name of the pod we want to get the list of containers inside __kubectl_get_containers() {

__custom_func() { case ${last_command} in kubectl_get | kubectl_describe | kubectl_delete | kubectl_label | kubectl_stop) <del> __kubectl_get_resource </del> <ins> __kubectl_get_resource return ;; kubectl_logs) __kubectl_require_pod_and_container return ;; kubectl_exec) __kubectl_get_resource_pod </ins> return ;; <del> kubectl_logs) __kubectl_require_pod_and_container return ;; </del> *) ;; esac