diff --git a/k8s-vault-minkube-start.sh b/k8s-vault-minkube-start.sh index 1e9cd2738..97790ffaf 100755 --- a/k8s-vault-minkube-start.sh +++ b/k8s-vault-minkube-start.sh @@ -3,13 +3,27 @@ # set -o pipefail # set -o nounset -echo "This is only a script for demoing purposes. You need to have installed: minikube with docker (or comment out line 8 and work at your own k8s setup), helm, kubectl, jq, vault, grep, cat, sed and is only tested on mac and ubuntu" +function checkCommandsAvailable() { + for var in "$@" + do + if ! [ -x "$(command -v "$var")" ]; then + echo "🔥 ${var} is not installed." >&2 + exit 1 + else + echo "🏄 $var is installed..." + fi + done +} + +checkCommandsAvailable helm minikube jq vault sed grep docker grep cat + +echo "This is only a script for demoing purposes. You can comment out line 22 and work with your own k8s setup" echo "This script is based on the steps defined in https://learn.hashicorp.com/tutorials/vault/kubernetes-minikube . Vault is awesome!" minikube start --kubernetes-version=v1.20.10 kubectl get configmaps | grep 'secrets-file' &> /dev/null if [ $? == 0 ]; then - echo "secrets config is already installed" + echo "secrets config is already installed" else kubectl apply -f k8s/secrets-config.yml fi