Skip to content

Commit d944fb4

Browse files
Pramodh Pallapothueriknordmark
authored andcommitted
Do not check for network connection everytime
We need network connection to install all kubernetes components and after that devive can work offline. We have a bug where we are looping forever for network connection for every reboot, that will be an issue in remote locations where there is no network connectivity. So skip that check if we alreayd installed all the components. Signed-off-by: Pramodh Pallapothu <pramodh@zededa.com>
1 parent ef435b6 commit d944fb4

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

pkg/kube/cluster-init.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,12 @@ setup_prereqs () {
199199
setup_cgroup
200200
#Check network and default routes are up
201201
wait_for_default_route
202-
check_network_connection
203202
wait_for_device_name
204203
chmod o+rw /dev/null
205204
wait_for_vault
206205
mount_kube_root
206+
# We need /var/lib to be mounted before we go for network connection check.
207+
check_network_connection
207208
}
208209

209210
config_cluster_roles() {

pkg/kube/cluster-utils.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ logmsg() {
2323
}
2424

2525
check_network_connection () {
26+
# Address the case where device is installed and moved to a location with no internet access"
27+
# If we already installed all the components, no internet access is not an issue.
28+
if [ -f /var/lib/all_components_initialized ]; then
29+
logmsg "All components already initialized, ignoring network connection check"
30+
return
31+
fi
32+
2633
while true; do
2734
ret=$(curl -o /dev/null -w "%{http_code}" -s "https://get.k3s.io")
2835
if [ "$ret" -eq 200 ]; then
@@ -379,4 +386,4 @@ Nodes_tie_breaker_config_apply() {
379386
kubectl label node "${notTbNode}" "${TIE_BREAKER_NODE_LABEL}=${TIE_BREAKER_NODE_LABEL_UNSET_VALUE}" --overwrite
380387
kubectl uncordon "${notTbNode}"
381388
done
382-
}
389+
}

0 commit comments

Comments
 (0)