Merge pull request '「」 feat(p2): successfully migrated to alpine && 「」 feat(p1): removed useless sleep in scripts' (#1) from redo-p2 into main

Reviewed-on: https://codeberg.org/27/inception-of-things/pulls/1
This commit is contained in:
KeyZox
2025-12-17 16:45:24 +01:00
4 changed files with 40 additions and 26 deletions

View File

@ -6,8 +6,18 @@ echo "Launching k3s install"
curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--write-kubeconfig-mode 644" sh -s - server --cluster-init --node-ip=$S_ADDR --bind-address=$S_ADDR --advertise-address=$S_ADDR curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--write-kubeconfig-mode 644" sh -s - server --cluster-init --node-ip=$S_ADDR --bind-address=$S_ADDR --advertise-address=$S_ADDR
# Additional wait to ensure API is responsive (optional but helpful) # Additional wait to ensure API is responsive (optional but helpful)
echo Waiting I=0
sleep 15 until k3s kubectl get --raw='/readyz' > /dev/null 2>&1; do
echo "Waiting for K3s to be ready..."
sleep 5
I=$((I+1))
if [ $I -eq 5 ]; then
echo "threshold gone, ffs"
exit 1
fi
done
echo "K3s is ready!"
echo "Copying token" echo "Copying token"
cat /var/lib/rancher/k3s/server/node-token > /vagrant/node-token cat /var/lib/rancher/k3s/server/node-token > /vagrant/node-token

View File

@ -4,16 +4,16 @@ S_ADDR="192.168.56.110"
SW_ADDR="192.168.56.111" SW_ADDR="192.168.56.111"
# In setup-SW.sh, before the k3s install command # In setup-SW.sh, before the k3s install command
# echo "Checking connectivity to server" echo "Checking connectivity to server"
# I=0 I=0
# while ! curl -k https://$S_ADDR:6443/healthz > /dev/null 2>&1; do while ! curl -k https://$S_ADDR:6443/readyz > /dev/null 2>&1; do
# echo "Server API not reachable yet, waiting..." echo "Server API not reachable yet, waiting..."
# sleep 5 sleep 5
# I=$((I+1)) I=$((I+1))
# if [ $I -eq 5 ]; then if [ $I -eq 5 ]; then
# exit 1 exit 1
# fi fi
# done done
echo "Server is reachable, proceeding with k3s agent install" echo "Server is reachable, proceeding with k3s agent install"
echo "Waiting for token" echo "Waiting for token"

13
p2/Vagrantfile vendored
View File

@ -13,19 +13,9 @@ if XDG_RUNTIME_DIR == "unknown"
raise "XDG_RUNTIME_DIR is not set" raise "XDG_RUNTIME_DIR is not set"
end end
# Here are the expected specifications:
# • The machine names must be the login of someone of your team. The hostname
# of the first machine must be followed by the capital letter S (like Server). The
# hostname of the second machine must be followed by SW (like ServerWorker).
# • Have a dedicated IP on the eth1 interface. The IP of the first machine (Server)
# will be 192.168.56.110, and the IP of the second machine (ServerWorker) will be
# 192.168.56.111.
# • Be able to connect with SSH on both machines with no password.
Vagrant.configure("2") do |config| Vagrant.configure("2") do |config|
config.vagrant.plugins = [] config.vm.box = "generic/alpine319"
config.vm.box = "debian/bookworm64"
config.vm.provider "#{IOT_PROVIDER}" do |provider| config.vm.provider "#{IOT_PROVIDER}" do |provider|
provider.cpus = 1 provider.cpus = 1
provider.memory = 1024 provider.memory = 1024
@ -34,6 +24,7 @@ Vagrant.configure("2") do |config|
config.vm.define "#{IOT_LOGIN}S" do |server| config.vm.define "#{IOT_LOGIN}S" do |server|
server.vm.hostname = "#{IOT_LOGIN}S" server.vm.hostname = "#{IOT_LOGIN}S"
server.vm.network "private_network", ip: "192.168.56.110", auto_config: true server.vm.network "private_network", ip: "192.168.56.110", auto_config: true
server.vm.synced_folder ".", "/vagrant"
server.vm.provision "shell", path: "scripts/setup-S.sh" server.vm.provision "shell", path: "scripts/setup-S.sh"
server.vm.provision "shell", path: "scripts/deploy-apps.sh" server.vm.provision "shell", path: "scripts/deploy-apps.sh"

View File

@ -1,7 +1,20 @@
#!/usr/bin/env sh #!/usr/bin/env sh
sudo apt update S_ADDR="192.168.56.110"
sudo apt install curl -y
echo "Launching k3s install" echo "Launching k3s install"
curl -sfL https://get.k3s.io | sh -s - server --cluster-init --node-ip=192.168.56.110 curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--write-kubeconfig-mode 644" sh -s - server --cluster-init --node-ip=$S_ADDR --bind-address=$S_ADDR --advertise-address=$S_ADDR
# Wait for K3s to be ready
I=0
until k3s kubectl get --raw='/healthz' > /dev/null 2>&1; do
echo "Waiting for K3s to be ready..."
sleep 5
I=$((I+1))
if [ $I -eq 5 ]; then
echo "threshold gone, ffs"
exit 1
fi
done
echo "K3s is ready!"