Skip to content

Commit b010bb6

Browse files
UX imporvements for worker nodes (#3409)
1 parent e1d115f commit b010bb6

5 files changed

Lines changed: 49 additions & 2 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
11
#!/bin/bash
22

3+
export PATH="$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH"
4+
source $SNAP/actions/common/utils.sh
5+
6+
if [ -e ${SNAP_DATA}/var/lock/clustered.lock ]
7+
then
8+
echo "This MicroK8s deployment is acting as a node in a cluster. Please use the microk8s helm on the master."
9+
exit 0
10+
fi
11+
12+
exit_if_stopped
13+
314
"${SNAP}/bin/helm" --kubeconfig="${SNAP_DATA}"/credentials/client.config "$@"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
11
#!/bin/bash
22

3+
export PATH="$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH"
4+
source $SNAP/actions/common/utils.sh
5+
6+
if [ -e ${SNAP_DATA}/var/lock/clustered.lock ]
7+
then
8+
echo "This MicroK8s deployment is acting as a node in a cluster. Please use the microk8s helm on the master."
9+
exit 0
10+
fi
11+
12+
exit_if_stopped
13+
314
"${SNAP}/bin/helm" --kubeconfig="${SNAP_DATA}"/credentials/client.config "$@"

scripts/calico/upgrade.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,10 @@ def mark_apply_needed(lock_file):
168168
"""
169169
Remove the lock file provided so the apiserver kicker will re apply the CNI manifest
170170
"""
171-
os.remove(lock_file)
171+
try:
172+
os.remove(lock_file)
173+
except OSError:
174+
pass
172175

173176

174177
def main():

scripts/inspect.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,11 @@ then
467467
check_service $svc_flanneld
468468
check_service $svc_etcd
469469
else
470-
check_service $svc_dqlite
470+
if ! [ -e "${SNAP_DATA}/var/lock/no-k8s-dqlite" ]
471+
then
472+
# workers do not run dqlite
473+
check_service $svc_dqlite
474+
fi
471475
fi
472476

473477
if ! [ -e "${SNAP_DATA}/var/lock/no-apiserver-proxy" ]

scripts/wrappers/join.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,23 @@ def update_apiserver_proxy(master_ip, api_port):
778778
service("restart", "apiserver-proxy")
779779

780780

781+
def print_worker_usage():
782+
"""
783+
Print Worker usage
784+
"""
785+
print("")
786+
print("The node has joined the cluster and will appear in the nodes list in a few seconds.")
787+
print("")
788+
print("This worker node gets automatically configured with the API server endpoints.")
789+
print(
790+
"If the API servers are behind a loadbalancer please set the '--refresh-interval' to '0s' in:"
791+
)
792+
print(" /var/snap/microk8s/current/args/apiserver-proxy")
793+
print("and replace the API server endpoints with the one provided by the loadbalancer in:")
794+
print(" /var/snap/microk8s/current/args/traefik/provider.yaml")
795+
print("")
796+
797+
781798
def join_dqlite_worker_node(info, master_ip, master_port, token):
782799
"""
783800
Join this node as a worker to a cluster running dqlite.
@@ -806,6 +823,7 @@ def join_dqlite_worker_node(info, master_ip, master_port, token):
806823
update_apiserver_proxy(master_ip, info["apiport"])
807824
mark_worker_node()
808825
mark_no_cert_reissue()
826+
print_worker_usage()
809827

810828

811829
def join_dqlite_master_node(info, master_ip, token):

0 commit comments

Comments
 (0)