Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add checks to see if needed executable are available #67

Merged
merged 4 commits into from
Nov 24, 2021
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions k8s-vault-minkube-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down