Implement kubectl-krew support

This commit is contained in:
dabruh 2022-11-10 15:45:51 +01:00
parent 279fcecbf1
commit 6ad6cf3504
2 changed files with 28 additions and 0 deletions

View file

@ -13,3 +13,5 @@ apt-laptop:brightnessctl
apt-any:libxcb-render0-dev,libffi-dev,python3-dev,python3-cffi
pip-any:flashfocus
krew-any:ctx,krew,ns,slice,stern,tree

View file

@ -130,6 +130,30 @@ function install_picom() {
rm -Rf "$tmp"
}
function setup_krew_plugins() {
local targets=("krew-any") packages
if ! command -v kubectl-krew >/dev/null; then
echo "WARN: Krew not installed: kubectl-krew"
return 1
fi
for package in $(get_packages "${targets[@]}"); do
if kubectl-krew list | grep -q "^$package$" >/dev/null; then
if $UPGRADE_PACKAGES; then
echo "Package '$package' will be upgraded."
else
echo "Package '$package' already exists."
continue
fi
else
echo "Package '$package' will be installed."
fi
kubectl-krew install "$package" || return 2
done
}
#
# Setup for Arch-like systems
#
@ -183,6 +207,7 @@ function setup_arch() {
setup_arch_with_pip || return 4
configure_sddm || return 5
configure_ufw || return 6
setup_krew_plugins || return 7
}
#
@ -238,6 +263,7 @@ function setup_debian() {
setup_debian_with_git || return 4
configure_sddm || return 5
configure_ufw || return 6
setup_krew_plugins || return 7
}
ID_LIKE="$(grep ID_LIKE= </etc/os-release | cut -d= -f2)"