From 734c060909209950d7cbea68ead5a736631912d7 Mon Sep 17 00:00:00 2001 From: Steven Polley Date: Sun, 17 Dec 2023 17:44:32 -0700 Subject: [PATCH] change directory structure for ignition --- 00-provisioning/README.md | 44 +++++++++++++++++++ .../kube-node01-boot.yaml} | 0 .../kube-node01-full.yaml} | 0 .../kube-node02-boot.yaml} | 0 .../kube-node02-full.yaml} | 0 .../kube-node03-boot.yaml} | 0 .../kube-node03-full.yaml} | 0 7 files changed, 44 insertions(+) create mode 100644 00-provisioning/README.md rename 00-provisioning/{ignition/kube-node01-boot-butane.yaml => butane/kube-node01-boot.yaml} (100%) rename 00-provisioning/{ignition/kube-node01-full-butane.yaml => butane/kube-node01-full.yaml} (100%) rename 00-provisioning/{ignition/kube-node02-boot-butane.yaml => butane/kube-node02-boot.yaml} (100%) rename 00-provisioning/{ignition/kube-node02-full-butane.yaml => butane/kube-node02-full.yaml} (100%) rename 00-provisioning/{ignition/kube-node03-boot-butane.yaml => butane/kube-node03-boot.yaml} (100%) rename 00-provisioning/{ignition/kube-node03-full-butane.yaml => butane/kube-node03-full.yaml} (100%) diff --git a/00-provisioning/README.md b/00-provisioning/README.md new file mode 100644 index 0000000..44143ae --- /dev/null +++ b/00-provisioning/README.md @@ -0,0 +1,44 @@ +Adding new nodes + +1. Create a boot and full butane yaml file for the new host in the butane directory +2. Generate ignition JSON files from butane YAML files using the below snippet +3. Check the resulting .json files into version control + +```bash +# Be sure to run from 00-provisioning directory +cd 00-provisioning + +# Loop through all butane files and generate ignition files +for i in butane/*.yaml; do + FILENAME=$( echo $i | cut -c 8- | head -c -6) + echo running butane on $FILENAME + butane butane/$FILENAME.yaml > ignition/$FILENAME.json +done + +``` + +After you've checked the ignition files into version control, provision the server, either on baremetal or VM - example with virtualbox. + +```bash + +# Stop git bash being stupid +export MSYS_NO_PATHCONV=1 + +# Function to create VirtualBox VM, accepts name of VM as argument +create_vm() { + if [ -z "$1" ]; then + echo "error: create_vm() called without specifying a VM name" + echo "Usage: create_vm " + return + fi + "C:/Program Files/Oracle/VirtualBox/vboxmanage.exe" import --vsys 0 --vmname "$1" "D:/VirtualBox/OVA/fedora-coreos-39.20231119.3.0-virtualbox.x86_64.ova" + "C:/Program Files/Oracle/VirtualBox/vboxmanage.exe" modifyvm $1 --nic1 bridged + "C:/Program Files/Oracle/VirtualBox/vboxmanage.exe" modifyvm $1 --bridge-adapter1 "Intel(R) Ethernet Controller I225-V" + "C:/Program Files/Oracle/VirtualBox/vboxmanage.exe" guestproperty set $1 "/Ignition/Config" "$(cat ignition/$1-boot.json)" + "C:/Program Files/Oracle/VirtualBox/vboxmanage.exe" startvm $1 --type headless +} + +create_vm kube-node01 +create_vm kube-node02 +create_vm kube-node03 +``` \ No newline at end of file diff --git a/00-provisioning/ignition/kube-node01-boot-butane.yaml b/00-provisioning/butane/kube-node01-boot.yaml similarity index 100% rename from 00-provisioning/ignition/kube-node01-boot-butane.yaml rename to 00-provisioning/butane/kube-node01-boot.yaml diff --git a/00-provisioning/ignition/kube-node01-full-butane.yaml b/00-provisioning/butane/kube-node01-full.yaml similarity index 100% rename from 00-provisioning/ignition/kube-node01-full-butane.yaml rename to 00-provisioning/butane/kube-node01-full.yaml diff --git a/00-provisioning/ignition/kube-node02-boot-butane.yaml b/00-provisioning/butane/kube-node02-boot.yaml similarity index 100% rename from 00-provisioning/ignition/kube-node02-boot-butane.yaml rename to 00-provisioning/butane/kube-node02-boot.yaml diff --git a/00-provisioning/ignition/kube-node02-full-butane.yaml b/00-provisioning/butane/kube-node02-full.yaml similarity index 100% rename from 00-provisioning/ignition/kube-node02-full-butane.yaml rename to 00-provisioning/butane/kube-node02-full.yaml diff --git a/00-provisioning/ignition/kube-node03-boot-butane.yaml b/00-provisioning/butane/kube-node03-boot.yaml similarity index 100% rename from 00-provisioning/ignition/kube-node03-boot-butane.yaml rename to 00-provisioning/butane/kube-node03-boot.yaml diff --git a/00-provisioning/ignition/kube-node03-full-butane.yaml b/00-provisioning/butane/kube-node03-full.yaml similarity index 100% rename from 00-provisioning/ignition/kube-node03-full-butane.yaml rename to 00-provisioning/butane/kube-node03-full.yaml