diff --git a/configs/stage3_ubuntu/opt/mlab/bin/setup_k8s.sh b/configs/stage3_ubuntu/opt/mlab/bin/setup_k8s.sh index a4bad28..468bda5 100755 --- a/configs/stage3_ubuntu/opt/mlab/bin/setup_k8s.sh +++ b/configs/stage3_ubuntu/opt/mlab/bin/setup_k8s.sh @@ -41,6 +41,12 @@ export PATH=$PATH:/sbin:/usr/sbin:/opt/bin:/opt/mlab/bin # Capture K8S version for later usage. RELEASE=$(kubelet --version | awk '{print $2}') +# Whether the site's transit is donated or not. Will be "true" or "false". +DONATED=$( + curl --silent "https://siteinfo.${GCP_PROJECT}.measurementlab.net/v2/sites/donated.json" \ + | jq "any(. == \"${SITE}\")" +) + # Create a list of node labels NODE_LABELS="mlab/machine=${MACHINE}," NODE_LABELS+="mlab/site=${SITE}," @@ -48,7 +54,8 @@ NODE_LABELS+="mlab/metro=${METRO}," NODE_LABELS+="mlab/type=physical," NODE_LABELS+="mlab/project=${GCP_PROJECT}," NODE_LABELS+="mlab/ndt-version=production," -NODE_LABELS+="mlab/managed=${MANAGED}" +NODE_LABELS+="mlab/managed=${MANAGED}," +NODE_LABELS+="mlab/donated=${DONATED}" sed -ie "s|KUBELET_KUBECONFIG_ARGS=|KUBELET_KUBECONFIG_ARGS=--node-labels=$NODE_LABELS |g" \ /etc/systemd/system/kubelet.service.d/10-kubeadm.conf