Skip to content

Commit

Permalink
fix: Application ID as parameter to k3s scripts (#31)
Browse files Browse the repository at this point in the history
Co-authored-by: George Kitsos <[email protected]>
  • Loading branch information
gkitsos01 and George Kitsos authored Oct 2, 2024
1 parent b1b74f3 commit ed6a197
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion installation-scripts-onm/MASTER_INSTALL_SCRIPT.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ echo "Master install script"
K3S_DEP_PATH=$HOME/k3s

echo "Installing K3s Server"
sudo -H -u ubuntu bash -c 'wget -P $K3S_DEP_PATH https://raw.githubusercontent.com/eu-nebulous/sal-scripts/dev/k3s/install-kube-k3s-server-u22-wg.sh && chmod +x $K3S_DEP_PATH/install-kube-k3s-server-u22-wg.sh && $K3S_DEP_PATH/install-kube-k3s-server-u22-wg.sh
sudo -H -u ubuntu bash -c "wget -P ${K3S_DEP_PATH} https://raw.githubusercontent.com/eu-nebulous/sal-scripts/dev/k3s/install-kube-k3s-server-u22-wg.sh && chmod +x $K3S_DEP_PATH/install-kube-k3s-server-u22-wg.sh && $K3S_DEP_PATH/install-kube-k3s-server-u22-wg.sh $APPLICATION_ID"
2 changes: 1 addition & 1 deletion installation-scripts-onm/MASTER_PRE_INSTALL_SCRIPT.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ WIREGUARD_VPN_IP=`ip a | grep wg | grep inet | awk '{print $2}' | cut -d'/' -f1`
echo "WIREGUARD_VPN_IP= $WIREGUARD_VPN_IP";

echo "Executing k3s-preinstall script\n"
sudo -H -u ubuntu bash -c 'wget -P $K3S_DEP_PATH https://raw.githubusercontent.com/eu-nebulous/sal-scripts/dev/k3s/preinstall-kube-k3s-u22.sh && chmod +x $K3S_DEP_PATH/preinstall-kube-k3s-u22.sh && $K3S_DEP_PATH/preinstall-kube-k3s-u22.sh
sudo -H -u ubuntu bash -c "wget -P ${K3S_DEP_PATH} https://raw.githubusercontent.com/eu-nebulous/sal-scripts/dev/k3s/preinstall-kube-k3s-u22.sh && chmod +x $K3S_DEP_PATH/preinstall-kube-k3s-u22.sh && $K3S_DEP_PATH/preinstall-kube-k3s-u22.sh"
2 changes: 1 addition & 1 deletion installation-scripts-onm/WORKER_INSTALL_SCRIPT.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ echo "Worker install script"
echo "Installing K3s Agent"
K3S_DEP_PATH=$HOME/k3s

sudo -H -u ubuntu bash -c 'wget -P $K3S_DEP_PATH https://raw.githubusercontent.com/eu-nebulous/sal-scripts/dev/k3s/install-kube-k3s-agent-u22-wg.sh && chmod +x $K3S_DEP_PATH/install-kube-k3s-agent-u22-wg.sh && $K3S_DEP_PATH/install-kube-k3s-agent-u22-wg.sh
sudo -H -u ubuntu bash -c "wget -P ${K3S_DEP_PATH} https://raw.githubusercontent.com/eu-nebulous/sal-scripts/dev/k3s/install-kube-k3s-agent-u22-wg.sh && chmod +x $K3S_DEP_PATH/install-kube-k3s-agent-u22-wg.sh && $K3S_DEP_PATH/install-kube-k3s-agent-u22-wg.sh $APPLICATION_ID"
2 changes: 1 addition & 1 deletion installation-scripts-onm/WORKER_PRE_INSTALL_SCRIPT.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ WIREGUARD_VPN_IP=`ip a | grep wg | grep inet | awk '{print $2}' | cut -d'/' -f1`
echo "WIREGUARD_VPN_IP= $WIREGUARD_VPN_IP";

echo "Executing k3s-preinstall script\n"
sudo -H -u ubuntu bash -c 'wget -P $K3S_DEP_PATH https://raw.githubusercontent.com/eu-nebulous/sal-scripts/dev/k3s/preinstall-kube-k3s-u22.sh && chmod +x $K3S_DEP_PATH/preinstall-kube-k3s-u22.sh && $K3S_DEP_PATH/preinstall-kube-k3s-u22.sh
sudo -H -u ubuntu bash -c "wget -P ${K3S_DEP_PATH} https://raw.githubusercontent.com/eu-nebulous/sal-scripts/dev/k3s/preinstall-kube-k3s-u22.sh && chmod +x $K3S_DEP_PATH/preinstall-kube-k3s-u22.sh && $K3S_DEP_PATH/preinstall-kube-k3s-u22.sh"
2 changes: 1 addition & 1 deletion k3s/install-kube-k3s-agent-u22-wg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ sudo touch $LOGFILE
sudo chown $USER:$USER $LOGFILE

WIREGUARD_SERVER=192.168.55.1
NODE_TOKEN=${APPLICATION_ID}
NODE_TOKEN=$1
K3S_VERSION=v1.26.15+k3s1

# All the output of this shell script is redirected to the LOGFILE
Expand Down
5 changes: 3 additions & 2 deletions k3s/install-kube-k3s-server-u22-wg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ K3S_DEP_PATH=$HOME/k3s
CILIUM_VERSION=1.15.5
POD_CIDR=10.244.0.0/16
K3S_VERSION=v1.26.15+k3s1
TOKEN=$1

# All the output of this shell script is redirected to the LOGFILE
exec 3>&1 4>&2
Expand All @@ -30,9 +31,9 @@ log_print(){
echo "$level [$(date)]: $Message" >&3
}

log_print INFO "Installing k3s server"
log_print INFO "Installing k3s server for APPLICATION_ID: ${TOKEN}"
WIREGUARD_VPN_IP=`ip a | grep wg | grep inet | awk '{print $2}' | cut -d'/' -f1`
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=${K3S_VERSION} INSTALL_K3S_EXEC="--cluster-cidr ${POD_CIDR} --token ${APPLICATION_ID} --flannel-backend=none --disable-network-policy --bind-address ${WIREGUARD_VPN_IP} --node-ip ${WIREGUARD_VPN_IP} --write-kubeconfig-mode 644" sh -
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=${K3S_VERSION} INSTALL_K3S_EXEC="--cluster-cidr ${POD_CIDR} --token ${TOKEN} --flannel-backend=none --disable-network-policy --bind-address ${WIREGUARD_VPN_IP} --node-ip ${WIREGUARD_VPN_IP} --write-kubeconfig-mode 644" sh -
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml

log_print INFO "Setting NODE_TOKEN environmental variable (default expiry 1d)"
Expand Down

0 comments on commit ed6a197

Please sign in to comment.