50 lines
1.3 KiB
Bash
Executable File
50 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Health checking DLS store, and install cluster's addons
|
|
|
|
source .common
|
|
|
|
prereqs_addons() {
|
|
for com in curl kubectl ; do
|
|
command -v $com 1>/dev/null || perror "Command $com is not installed, aborting..."
|
|
done
|
|
cluster=$(basename $ctxdir/clusters/*.yaml|sed 's/.yaml//')
|
|
}
|
|
|
|
install_addons() {
|
|
body='{"Kind":"cluster","Name":"'$cluster'","Assets":["addons"]}'
|
|
download_id=$(dls /authorize-download -d "$body"|tr -d \")
|
|
dls /public/downloads/${download_id}/addons |\
|
|
kubectl --kubeconfig kubeconfig apply -f -
|
|
}
|
|
|
|
approve_kubelet_certificates() {
|
|
tries=5
|
|
nodes_num=$(kctl get node -oname|wc -l)
|
|
while [ "$nodes_num" != "${#hosts[*]}" ] ; do
|
|
pinfo "Waiting for certificates requests to be created by Kubelet when it's ready..."
|
|
sleep 60s
|
|
csrs="$(kctl get csr -oname)"
|
|
if [ "$csrs" != "" ]; then
|
|
kctl certificate approve $csr
|
|
fi
|
|
((tries--))
|
|
if [ $tries < 1 ]; then
|
|
pinfo "Timeout waiting for kubelet certificates creation, please investigate why all nodes are not up by now"
|
|
break
|
|
fi
|
|
done
|
|
pinfo "All kubelets ($nodes_num) are up, enjoy !"
|
|
}
|
|
|
|
prereqs
|
|
prereqs_addons
|
|
check_conf
|
|
unlock_store
|
|
install_addons
|
|
|
|
declare -A hosts
|
|
get_hosts # get hosts list
|
|
approve_kubelet_certificates # clients and serving certs
|
|
|