feat: kn function to change kctx and ns

This commit is contained in:
AngeD 2022-10-11 16:06:21 +02:00
parent 8778a446c7
commit 63874b3739

View File

@ -12,8 +12,20 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
function kn() {
(set -e
if [ -n "$2" ]; then
kubectx "${1:l}"
kubens "$2"
else
kubens "$@"
fi
)
}
compdef -e _kubens.zsh kn
alias kx='kubectx' alias kx='kubectx'
alias kn='kubens'
alias k='kubectl' alias k='kubectl'
alias ksys='kubectl --namespace=kube-system' alias ksys='kubectl --namespace=kube-system'
alias ka='kubectl apply --recursive -f' alias ka='kubectl apply --recursive -f'