Update scripts

This commit is contained in:
Björn Busse 2024-01-12 07:19:55 +01:00
parent 2d68b3b249
commit 5d313d6e2d
2 changed files with 71 additions and 76 deletions

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
#
# Setup a local minikube cluster
# Setup a local k8s minikube cluster
# with k8s dashboard and flux
#
@ -39,14 +39,15 @@ readonly VERBOSE
minikube_driver="podman"
# We prefer podman but Ubuntu's podman is too old
if [[ $(grep '^ID=' /etc/os-release | awk -F'=' '{print $2}') == "ubuntu" ]]; then
minikube_driver="docker"
fi
# Start minikube
if ! $(minikube status) or $(minikube status | grep Nonexistent\|Stopped); then
if ! $(minikube status | grep Nonexistent\|Stopped); then
printf 'minikube is not running\nStarting minikube..'
if (( 0=="${VERBOSE}" )); then
if [[ 0 == "${VERBOSE}" ]]; then
minikube start --driver="${minikube_driver}"
else
minikube start --driver="${minikube_driver}" --alsologtostderr -v=7
@ -62,26 +63,25 @@ kubectl cluster-info
# Deploy k8s dashboard
if [[ $(kubectl get pods -A -o wide | grep kubernetes-dashboard | grep Running) ]]; then
printf "Installing k8s dashboard\n"
minikube addons enable metrics-server
# The metrics server collides with kube-prometheus-stack
#minikube addons enable metrics-server
minikube dashboard &
else
printf 'k8s dashboard is already running\n'
fi
# Install terraform if not in PATH
# or local version enforced
if ! $(which terraform) or 1=="$TF_FORCE_LOCAL"; then
# Install flux if local version enforced
if [[ "$TF_FORCE_LOCAL" = 1 ]]; then
printf "Fetching terraform archive..\n"
curl -LO "${TF_URL}"
unzip -o "${TF_ARCHIVE}"
unzip "${TF_ARCHIVE}"
TF_CMD="./terraform"
else
TF_CMD="terraform"
fi
# Install flux if not in PATH
# or local version enforced
if ! $(which flux) ] or 1=="$FLUX_FORCE_LOCAL"; then
# Install flux if local version enforced
if [[ "$FLUX_FORCE_LOCAL" = 1 ]]; then
printf "Fetching flux archive..\n"
curl -LO "${FLUX_URL}"
tar xf "${FLUX_ARCHIVE}"