mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2025-03-05 08:17:04 +00:00
Counting nodes in Ready state was too fragile, matching entries like: Ready,SchedulingDisabled NotReady By requiring whitespace on both side, we accept only clean Ready.
10 lines
653 B
Bash
Executable file
10 lines
653 B
Bash
Executable file
#!/usr/bin/env bash
|
|
# 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/" node-feature-discovery-job.json.template > node-feature-discovery-job.json
|
|
kubectl create -f node-feature-discovery-job.json
|