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

add completion support for namespace #33787

Merged

Conversation

silenceshell
Copy link
Member

@silenceshell silenceshell commented Jul 2, 2021

Add namespace completion supports for istioctl.

$ istioctl -i <tab><tab>
istio-system          kube-public          istio-demo          metallb-system
$ istioctl -n <tab><tab>
istio-system          kube-public          istio-demo          metallb-system

[ ] Configuration Infrastructure
[ ] Docs
[ ] Installation
[ ] Networking
[ ] Performance and Scalability
[ ] Policies and Telemetry
[ ] Security
[ ] Test and Release
[X] User Experience
[ ] Developer Infrastructure

This PR needs cobra 1.2.0 for the PR RegisterFlagCompletionFunc as a global var not working in multi-threaded programs, to fix concurrent map writes errors of tests in parallel of istio(here is an example, this is introduced by #28434).
And as cobra 1.2.0 add a new feature Automatically adds completion command for shell completions, this PR will also add a new command istioctl completion. I will replace istioctl collateral --bash/--zsh to istioctl completion bash/zsh in another PR later.

Pull Request Attributes

Please check any characteristics that apply to this pull request.

[ ] Does not have any user-facing changes. This may include CLI changes, API changes, behavior changes, performance improvements, etc.

@google-cla google-cla bot added the cla: yes Set by the Google CLA bot to indicate the author of a PR has signed the Google CLA. label Jul 2, 2021
@istio-testing istio-testing added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 2, 2021
@istio-policy-bot
Copy link

🤔 🐛 You appear to be fixing a bug in Go code, yet your PR doesn't include updates to any test files. Did you forget to add a test?

Courtesy of your friendly test nag.

Copy link
Member

@shamsher31 shamsher31 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, But my only concern is the cobra version upgrade. Not sure if it will break something which is not in the test.

I will let others provide their feedback.

@silenceshell silenceshell changed the title add completion support for namespace [WIP]add completion support for namespace Jul 2, 2021
@istio-testing istio-testing added the do-not-merge/work-in-progress Block merging of a PR because it isn't ready yet. label Jul 2, 2021
add release note

upgrade cobra to 1.2.1 for parallel use of the cmd.RegisterFlagCompletionFunc()
@silenceshell silenceshell force-pushed the istioctl-flag-namespace-completion branch from e711ffc to ff42ee2 Compare July 4, 2021 01:10
@silenceshell silenceshell changed the title [WIP]add completion support for namespace add completion support for namespace Jul 4, 2021
@istio-testing istio-testing removed the do-not-merge/work-in-progress Block merging of a PR because it isn't ready yet. label Jul 4, 2021
Copy link
Member

@howardjohn howardjohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't get this working locally using zsh, but maybe just my environment.. LGTM

@istio-testing istio-testing merged commit 4d4a26a into istio:master Jul 8, 2021
@silenceshell silenceshell deleted the istioctl-flag-namespace-completion branch July 9, 2021 02:26
@ericvn
Copy link
Contributor

ericvn commented Jul 9, 2021

I did get this working locally (Mac using zsh) by doing a make istioctl followed by a source <(./out/darwin_amd64/istioctl completion zsh) and then did ./out/darwin_amd64/istioctl -n<tab><tab>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/user experience cla: yes Set by the Google CLA bot to indicate the author of a PR has signed the Google CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants