Skip to content

Commit

Permalink
Adds new mlab/donated node label (#262)
Browse files Browse the repository at this point in the history
This can be used for any number of purposes. For example, we could choose to
use it as a node selector for pods such that we only deploy certain workloads
to donated or non-donated sites.
  • Loading branch information
nkinkade authored Jun 11, 2024
1 parent 3a98990 commit 5e98360
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion configs/stage3_ubuntu/opt/mlab/bin/setup_k8s.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,21 @@ 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},"
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
Expand Down

0 comments on commit 5e98360

Please sign in to comment.