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

Generating the shell autocompletion files reqires a valid kubeconfig #353

Open
kastl-ars opened this issue Jan 29, 2025 · 2 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.

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

2 participants