Skip to content

Commit

Permalink
test: Add bash aliases and completion for kubectl
Browse files Browse the repository at this point in the history
This commit adds the following to the test VMs:

* Alias k for kubectl
* Alias ks for kubectl -n kube-system
* Shell function cilium_pod $NODE_NAME for getting cilium-agent pod name
* Bash completion for kubectl

Signed-off-by: Martynas Pumputis <m@lambda.lt>
  • Loading branch information
brb authored and borkmann committed Mar 27, 2020
1 parent 0b5e263 commit 53cf46a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/provision/k8s_install.sh
Expand Up @@ -407,6 +407,21 @@ else
sudo systemctl stop etcd
fi

# Add aliases and bash completion for kubectl
cat <<EOF >> /home/vagrant/.bashrc
# kubectl
source <(kubectl completion bash)
alias k='kubectl'
complete -F __start_kubectl k
alias ks='kubectl -n kube-system'
complete -F __start_kubectl ks
cilium_pod() {
kubectl -n kube-system get pods -l k8s-app=cilium \
-o jsonpath="{.items[?(@.spec.nodeName == \"\$1\")].metadata.name}"
}
EOF

# Create world network
docker network create --subnet=192.168.9.0/24 outside
docker run --net outside --ip 192.168.9.10 --restart=always -d docker.io/cilium/demo-httpd:latest
Expand Down

0 comments on commit 53cf46a

Please sign in to comment.