2016-07-14 14:56:43 +00:00
|
|
|
#!/usr/bin/env bash
|
2018-02-23 10:53:22 +00:00
|
|
|
# Get the number of nodes in Ready state in the Kubernetes cluster
|
2018-07-26 12:20:57 +00:00
|
|
|
NumNodes=$(kubectl get nodes | grep -i ' ready ' | wc -l)
|
2016-07-12 00:30:49 +00:00
|
|
|
|
2016-07-14 14:56:43 +00:00
|
|
|
# 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
|
2018-03-12 16:04:37 +00:00
|
|
|
# We set the NODE_NAME environemnt variable to get the Kubernetes node object.
|
2018-09-27 11:54:45 +00:00
|
|
|
sed -e "s/COMPLETION_COUNT/$NumNodes/" -e "s/PARALLELISM_COUNT/$NumNodes/" node-feature-discovery-job.yaml.template > node-feature-discovery-job.yaml
|
|
|
|
kubectl create -f node-feature-discovery-job.yaml
|