mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2025-03-28 10:47:23 +00:00
Merge pull request #161 from marquiz/feature/job-affinity
Use pod anti-affinity in the worker Job template spec
This commit is contained in:
commit
7d6049e4d6
2 changed files with 10 additions and 5 deletions
|
@ -26,8 +26,6 @@ fi
|
|||
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 environment variable to get the Kubernetes node object.
|
||||
sed -e "s/completions:.*$/completions: $NumNodes/" \
|
||||
-e "s/parallelism:.*$/parallelism: $NumNodes/" \
|
||||
|
|
|
@ -15,6 +15,16 @@ spec:
|
|||
spec:
|
||||
hostNetwork: true
|
||||
dnsPolicy: ClusterFirstWithHostNet
|
||||
affinity:
|
||||
podAntiAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
- topologyKey: kubernetes.io/hostname
|
||||
labelSelector:
|
||||
matchExpressions:
|
||||
- key: app
|
||||
operator: In
|
||||
values:
|
||||
- node-feature-discovery
|
||||
containers:
|
||||
- env:
|
||||
- name: NODE_NAME
|
||||
|
@ -28,9 +38,6 @@ spec:
|
|||
args:
|
||||
- "--oneshot"
|
||||
- "--server=nfd-master:8080"
|
||||
ports:
|
||||
- containerPort: 7156
|
||||
hostPort: 7156
|
||||
volumeMounts:
|
||||
- name: host-boot
|
||||
mountPath: "/host-boot"
|
||||
|
|
Loading…
Add table
Reference in a new issue