Created
March 20, 2024 15:36
-
-
Save bossjones/3b3a4bf7bf9c0393cdcb8370847082a9 to your computer and use it in GitHub Desktop.
example_check_existence_of_command.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# SOURCE: https://github.com/kodekloudhub/certified-kubernetes-administrator-course/blob/master/kubeadm-clusters/apple-silicon/deploy-virtual-machines.sh | |
# When VMs are deleted, IPs remain allocated in dhcpdb | |
# IP reclaim: https://discourse.ubuntu.com/t/is-it-possible-to-either-specify-an-ip-address-on-launch-or-reset-the-next-ip-address-to-be-used/30316 | |
ARG=$1 | |
set -euo pipefail | |
# Set the build mode | |
# "BRIDGE" - Places VMs on your local network so cluster can be accessed from browser. | |
# You must have enough spare IPs on your network for the cluster nodes. | |
# "NAT" - Places VMs in a private virtual network. Cluster cannot be accessed | |
# without setting up a port forwarding rule for every NodePort exposed. | |
# Use this mode if for some reason BRIDGE doesn't work for you. | |
BUILD_MODE="BRIDGE" | |
RED="\033[1;31m" | |
YELLOW="\033[1;33m" | |
GREEN="\033[1;32m" | |
BLUE="\033[1;34m" | |
NC="\033[0m" | |
if ! command -v jq > /dev/null | |
then | |
echo -e "${RED}'jq' not found. Please install it${NC}" | |
echo "https://github.com/stedolan/jq/wiki/Installation#macos" | |
exit 1 | |
fi | |
if ! command -v multipass > /dev/null | |
then | |
echo -e "${RED}'multipass' not found. Please install it${NC}" | |
echo "https://multipass.run/install" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment