mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2025-03-05 08:17:04 +00:00
Use pod anti-affinity in the worker Job template spec
Use pod anti-affinity to explicitly indicate that pods should be scheduled on separate nodes. And, remove the obscure and non-obvious ports definition whose only purpose was to reach the same effect.
This commit is contained in:
parent
cb2fbba043
commit
dea9406007
2 changed files with 10 additions and 5 deletions
|
@ -26,8 +26,6 @@ fi
|
||||||
NumNodes=$(kubectl get nodes | grep -i ' ready ' | wc -l)
|
NumNodes=$(kubectl get nodes | grep -i ' ready ' | wc -l)
|
||||||
|
|
||||||
# We set the .spec.completions and .spec.parallelism to the node count
|
# 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.
|
# We set the NODE_NAME environment variable to get the Kubernetes node object.
|
||||||
sed -e "s/completions:.*$/completions: $NumNodes/" \
|
sed -e "s/completions:.*$/completions: $NumNodes/" \
|
||||||
-e "s/parallelism:.*$/parallelism: $NumNodes/" \
|
-e "s/parallelism:.*$/parallelism: $NumNodes/" \
|
||||||
|
|
|
@ -15,6 +15,16 @@ spec:
|
||||||
spec:
|
spec:
|
||||||
hostNetwork: true
|
hostNetwork: true
|
||||||
dnsPolicy: ClusterFirstWithHostNet
|
dnsPolicy: ClusterFirstWithHostNet
|
||||||
|
affinity:
|
||||||
|
podAntiAffinity:
|
||||||
|
requiredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
- topologyKey: kubernetes.io/hostname
|
||||||
|
labelSelector:
|
||||||
|
matchExpressions:
|
||||||
|
- key: app
|
||||||
|
operator: In
|
||||||
|
values:
|
||||||
|
- node-feature-discovery
|
||||||
containers:
|
containers:
|
||||||
- env:
|
- env:
|
||||||
- name: NODE_NAME
|
- name: NODE_NAME
|
||||||
|
@ -28,9 +38,6 @@ spec:
|
||||||
args:
|
args:
|
||||||
- "--oneshot"
|
- "--oneshot"
|
||||||
- "--server=nfd-master:8080"
|
- "--server=nfd-master:8080"
|
||||||
ports:
|
|
||||||
- containerPort: 7156
|
|
||||||
hostPort: 7156
|
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: host-boot
|
- name: host-boot
|
||||||
mountPath: "/host-boot"
|
mountPath: "/host-boot"
|
||||||
|
|
Loading…
Add table
Reference in a new issue