1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2025-03-15 13:07:48 +00:00
node-feature-discovery/label-nodes.sh
Markus Lehtonen fa47b0178d Use v0.4.0 release in README and deployment templates and script
Also, slightly adjust the deployment instructions in README to point out
that the templates should now be usable as is to run the latest released
version of NFD.
2019-05-21 11:19:30 +03:00

23 lines
814 B
Bash
Executable file

#!/usr/bin/env bash
this=`basename $0`
if [ $# -gt 1 ]; then
echo Usage: $this [IMAGE[:TAG]]
exit 1
fi
# Get the number of nodes in Ready state in the Kubernetes cluster
NumNodes=$(kubectl get nodes | grep -i ' ready ' | wc -l)
# We set the .spec.completions and .spec.parallelism to the node count
# We request a specific hostPort in the job spec to limit the number of pods
# that run on a node to one. As a result, one pod runs on each node in parallel
# We set the NODE_NAME environemnt variable to get the Kubernetes node object.
sed -e "s/COMPLETION_COUNT/$NumNodes/" \
-e "s/PARALLELISM_COUNT/$NumNodes/" \
nfd-worker-job.yaml.template > nfd-worker-job.yaml
if [ -n "$1" ]; then
sed -E "s,^(\s*)image:.+$,\1image: $1," -i nfd-worker-job.yaml
fi
kubectl create -f nfd-worker-job.yaml