website icon indicating copy to clipboard operation
website copied to clipboard

Improvement for k8s.io/docs/tasks/tools/included/optional-kubectl-configs-bash-linux/

Open adam-kafene opened this issue 4 years ago • 3 comments

Do we have any tips for Mac OS running Bash 5.X? I can't seem to find any good resources, haven't looked into the errors yet / trying to fix locally for myself. I plan on doing that, figured I'd ask here first.

adam-kafene avatar Mar 09 '22 19:03 adam-kafene

@adampeklay: This issue is currently awaiting triage.

SIG Docs takes a lead on issue triage for this website, but any Kubernetes member can accept issues by applying the triage/accepted label.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Mar 09 '22 19:03 k8s-ci-robot

I can't seem to get it working with Bash 5.1.X:

13:29 $ bash --version
GNU bash, version 5.1.16(1)-release (x86_64-apple-darwin21.1.0)
Copyright (C) 2020 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.
✔ ~
13:30 $
13:21 $ vim .bash_profile
✔ ~
13:25 $ tail -3 .bash_profile
export BASH_COMPLETION_COMPAT_DIR="/usr/local/etc/bash_completion.d"
[[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh"

(I then sourced .bash_profile)

13:26 $ type _init_completion
-bash: type: _init_completion: not found
✘-1 ~
13:26 $

As expected due to the error above, kubectl bash completion does not work:

13:27 $ echo 'alias k=kubectl' >>~/.bash_profile
✔ ~
13:27 $ echo 'complete -F __start_kubectl k' >>~/.bash_profile
✔ ~
13:27 $ source .bash_profile
✔ ~
13:27 $ k get dep-bash: completion: function `__start_kubectl' not found
13:27 $ k get dep

I uninstalled bash-completion, that I had installed previously and installed bash-completion@2 per your wikis instructions

13:29 $ brew list bash-completion@2
/usr/local/Cellar/bash-completion@2/2.11/etc/profile.d/bash_completion.sh
/usr/local/Cellar/bash-completion@2/2.11/share/bash-completion/ (743 files)
/usr/local/Cellar/bash-completion@2/2.11/share/cmake/ (2 files)
/usr/local/Cellar/bash-completion@2/2.11/share/pkgconfig/bash-completion.pc
✔ ~
13:29 $

adam-kafene avatar Mar 09 '22 19:03 adam-kafene

awesome, looks like I missed your issue. I'll close this one out, thanks!

adam-kafene avatar Mar 18 '22 13:03 adam-kafene