chg: Make Command Shorter

In an effort to have less to remember, the commands have been shortened
were possible. In some cases they have been moved around to organize
them so they are easier to remember.
This commit is contained in:
Khalifah Shabazz
2025-06-11 18:06:04 -04:00
parent b4136eb578
commit e5f54442c2
6 changed files with 95 additions and 102 deletions

View File

@@ -12,6 +12,9 @@
INSTALL_MODE = "MANUAL"
BOX_IMG = "ubuntu/jammy64"
#BOX_IMG = "ubuntu/lts-noble-64"
#BASE_MAC = "080027AA5560"
BOOT_TIMEOUT_SEC = 120
# Set the build mode
@@ -106,7 +109,7 @@ def setup_dns(node)
if INSTALL_MODE == "KUBEADM"
# Set up /etc/hosts
node.vm.provision "setup-hosts", :type => "shell", :path => "ubuntu/vagrant/setup-hosts.sh" do |s|
s.args = [NAT_IP_PREFIX, BUILD_MODE, NUM_WORKER_NODES, CONTROLPLANE_NAT_IP, NODE_IP_START]
s.args = [NAT_IP_PREFIX, BUILD_MODE, NUM_WORKER_NODES, CONTROLPLANE_NAT_IP, NODE_IP_START, INSTALL_MODE]
end
end
# Set up DNS resolution
@@ -142,6 +145,29 @@ Vagrant.configure("2") do |config|
# `vagrant box outdated`. This is not recommended.
config.vm.box_check_update = false
#config.vm.base_mac = BASE_MAC
# Provision a jumpbox
if INSTALL_MODE == "MANUAL"
# Provision a JumpBox
config.vm.define JUMPER_NAME do |node|
# Name shown in the GUI
node.vm.provider "virtualbox" do |vb|
vb.name = JUMPER_NAME
vb.memory = 512
vb.cpus = 1
end
node.vm.hostname = JUMPER_NAME
if BUILD_MODE == "BRIDGE"
adapter = ""
node.vm.network :public_network, bridge: get_bridge_adapter()
else
node.vm.network :private_network, ip: NAT_IP_PREFIX + ".#{JUMPER_NAT_START_IP}"
end
provision_kubernetes_node node
end
end
# Provision controlplane Nodes
config.vm.define CONTROLPLANE_NAME do |node|
# Name shown in the GUI
@@ -181,26 +207,6 @@ Vagrant.configure("2") do |config|
end
end
if INSTALL_MODE == "MANUAL"
# Provision a JumpBox
config.vm.define JUMPER_NAME do |node|
# Name shown in the GUI
node.vm.provider "virtualbox" do |vb|
vb.name = JUMPER_NAME
vb.memory = 512
vb.cpus = 1
end
node.vm.hostname = JUMPER_NAME
if BUILD_MODE == "BRIDGE"
adapter = ""
node.vm.network :public_network, bridge: get_bridge_adapter()
else
node.vm.network :private_network, ip: NAT_IP_PREFIX + ".#{JUMPER_NAT_START_IP}"
end
provision_kubernetes_node node
end
end
if BUILD_MODE == "BRIDGE"
# Trigger that fires after each VM starts.
# Does nothing until all the VMs have started, at which point it

View File

@@ -9,6 +9,7 @@ BUILD_MODE=$2
NUM_WORKER_NODES=$3
MASTER_IP_START=$4
NODE_IP_START=$5
INSTALL_MODE=$6
if [ "$BUILD_MODE" = "BRIDGE" ]
then
@@ -35,6 +36,7 @@ fi
# Remove unwanted entries
sed -e '/^.*ubuntu-jammy.*/d' -i /etc/hosts
#sed -e '/^.*ubuntu-noble.*/d' -i /etc/hosts
sed -e "/^.*${HOSTNAME}.*/d" -i /etc/hosts
# Export PRIMARY IP as an environment variable
@@ -42,11 +44,13 @@ echo "PRIMARY_IP=${MY_IP}" >> /etc/environment
[ "$BUILD_MODE" = "BRIDGE" ] && exit 0
# Update /etc/hosts about other hosts (NAT mode)
echo "${MY_NETWORK}.${MASTER_IP_START} controlplane" >> /etc//hosts
for i in $(seq 1 $NUM_WORKER_NODES)
do
num=$(( $NODE_IP_START + $i ))
echo "${MY_NETWORK}.${num} node0${i}" >> /etc//hosts
done
if [ "${INSTALL_MODE}" = "KUBEADM" ]
then
# Update /etc/hosts about other hosts (NAT mode)
echo "${MY_NETWORK}.${MASTER_IP_START} controlplane" >> /etc/hosts
for i in $(seq 1 $NUM_WORKER_NODES)
do
num=$(( $NODE_IP_START + $i ))
echo "${MY_NETWORK}.${num} node0${i}" >> /etc/hosts
done
fi