8000 Generating the shell autocompletion files reqires a valid kubeconfig · Issue #353 · rook/kubectl-rook-ceph · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Generating the shell autocompletion files reqires a valid kubeconfig #353

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

Open
kastl-ars opened this issue Jan 29, 2025 · 5 comments
Open

Comments

@kastl-ars
Copy link

Dear maintainers,

I found kubectl-rook-ceph and wanted to package it for openSUSE. Unfortunately creating the shell completion using the kubectl-rook-ceph completion xyz commands errors out due to a missing kubeconfig:

[   30s] Executing(%install): /usr/bin/bash -e /var/tmp/rpm-tmp.iKAS6L
[   30s] + umask 022
[   30s] + cd /home/abuild/rpmbuild/BUILD
[   30s] + /usr/bin/rm -rf /home/abuild/rpmbuild/BUILDROOT/kubectl-rook-ceph-0.9.3-0.x86_64
[   30s] + /usr/bin/mkdir -p /home/abuild/rpmbuild/BUILDROOT
[   30s] + /usr/bin/mkdir /home/abuild/rpmbuild/BUILDROOT/kubectl-rook-ceph-0.9.3-0.x86_64
[   30s] + cd kubectl-rook-ceph-0.9.3
[   30s] + install -D -m 0755 bin/kubectl-rook_ceph /home/abuild/rpmbuild/BUILDROOT/kubectl-rook-ceph-0.9.3-0.x86_64//usr/bin/kubectl-rook_ceph
[   30s] + mkdir -p /home/abuild/rpmbuild/BUILDROOT/kubectl-rook-ceph-0.9.3-0.x86_64/usr/share/bash-completion/completions/
[   30s] + /home/abuild/rpmbuild/BUILDROOT/kubectl-rook-ceph-0.9.3-0.x86_64//usr/bin/kubectl-rook_ceph completion bash
[   30s] Error: invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable
[   30s] error: Bad exit status from /var/tmp/rpm-tmp.iKAS6L (%install)

Creating an empyt ~/.kube/config file does not work.

Most of the tools that provide generation of shell completions do not require a kubeconfig for that, similar to being able to call -help or help or --help subcommands without requiring a configuration file.

Could this be changed in kubectl-rook-ceph, too?

Thanks in advance,
Johannes

@subhamkrai
Copy link
Collaborator

@kastl-ars sometime back tried command completion for krew plugin it was not available at that time. But I think it's been long time I can give it try again

@kastl-ars
Copy link
Author

That would be great. Just to be clear, there is an existing completion subcommand. I think that those completions only work when the executable is called directly, not via kubectl rook-ceph.

@nirs
Copy link
Contributor
nirs commented Mar 29, 2025

That would be great. Just to be clear, there is an existing completion subcommand. I think that those completions only work when the executable is called directly, not via kubectl rook-ceph.

Completion should work also for kubectl rook-ceph see this example from kubectl-gather plugin:

https://github.com/nirs/kubectl-gather?tab=readme-ov-file#shell-completion

@subhamkrai
Copy link
Collaborator

That would be great. Just to be clear, there is an existing completion subcommand. I think that those completions only work when the executable is called directly, not via kubectl rook-ceph.

Completion should work also for kubectl rook-ceph see this example from kubectl-gather plugin:

https://github.com/nirs/kubectl-gather?tab=readme-ov-file#shell-completion

will it work as official kubectl plugin also ?

@nirs
Copy link
Contributor
nirs commented Apr 2, 2025

will it work as official kubectl plugin also ?

What is "official" plugin? do you mean when installed via krew?

I'm using this for kubectl-gather installed manually from github on Linux and macOS and completion works. I did not try with krew since I did not packaged it as krew plugin, but it should work since krew is just a way to locate and deliver the plugin. During runtime it behaves just like any other plugin installed manually. kubectl or oc do the work of locating plugins and completion scripts and running them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
0