11#! /bin/bash
22# SPDX-FileCopyrightText: (C) 2025 Intel Corporation
33# SPDX-License-Identifier: Apache-2.0
4-
4+ # shellcheck disable=all
55
66RKE_INSTALLER_PATH=/" ${1:-/ tmp/ rke2-artifacts} "
77# for basic testing on a coder setup
@@ -116,42 +116,6 @@ else
116116fi
117117
118118# Start RKE2
119- # Check RKE2 start first time or after reboot
120- IPCHECK=" /var/lib/rancher/ip.log"
121- if [ -f " $IPCHECK " ]; then
122- # Check if the IP address changes, if changes print the banner
123- host_prev_ip=$( cat " $IPCHECK " )
124-
125- # Get the system ip
126- pub_inerface_name=$( route | grep ' ^default' | grep -o ' [^ ]*$' )
127- host_ip=$( ifconfig " ${pub_inerface_name} " | grep ' inet ' | awk ' {print $2}' )
128-
129- if [[ " $host_ip " != " $host_prev_ip " ]]; then
130- echo " IP changed"
131- CHANGE_MSG=" Warning: The Edge Node IP(" $host_ip " ) has changed since RKE2 install!"
132- banner="
133- ================================================================================
134- Edge Microvisor Toolkit - cluster bring up problem
135-
136- ****Looks the IP address of the system chnaged since RKE2 install*****
137-
138- OLD RKE2 cluster IP " $host_prev_ip "
139- NEW RKE2 cluster IP " $host_ip "
140-
141- IP address of the Node:
142- " $host_prev_ip " - Ensure IP address is persistent across the reboot!
143- See: https://ranchermanager.docs.rancher.com/getting-started
144- /installation-and-upgrade/installation-requirements#node-ip-
145- addresses $CHANGE_MSG
146-
147- =================================================================================
148- "
149- # Print the banner
150- echo " $banner " | sudo tee /dev/tty0
151- else
152- CHANGE_MSG=" IP address remained same after reboot."
153- fi
154- fi
155119echo " $( date) : Starting RKE2 4/13" | sudo tee -a /var/log/cluster-init.log | sudo tee /dev/tty0
156120sudo systemctl enable --now rke2-server.service
157121
@@ -243,6 +207,15 @@ IPCHECK="/var/lib/rancher/ip.log"
243207if [ ! -f " $IPCHECK " ]; then
244208 echo " $IP " | sudo tee " $IPCHECK "
245209fi
210+
211+ # Add rke2 installation flag, so that on next reboot it will not start again from begining.
212+
213+ RKE2_STATUS=" /var/lib/rancher/rke2_status"
214+
215+ if [ ! -f " $RKE2_STATUS " ]; then
216+ echo " success" | sudo tee " $RKE2_STATUS "
217+ fi
218+
246219# Print banner
247220
248221banner="
@@ -258,7 +231,7 @@ IP address of the Node:
258231 $IP - Ensure IP address is persistent across the reboot!
259232 See: https://ranchermanager.docs.rancher.com/getting-started
260233 /installation-and-upgrade/installation-requirements#node-ip-
261- addresses $CHANGE_MSG
234+ addresses
262235
263236To access and view the cluster's pods run:
264237 source /etc/environment
0 commit comments