Skip to content

Commit cb6bc27

Browse files
authored
Assign service account and split nodeSelectorTerms (#249)
tl;dr A single MatchExpressions didn't schedule the pods. From the docs on nodeSelectorTerms: "All matchExpressions associated with requiredDuringSchedulingIgnoredDuringExecution affinity and anti-affinity must be satisfied for the pod to be scheduled onto a node."
1 parent a5185ec commit cb6bc27

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

k8s-node-termination-handler/handler.libsonnet

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,17 @@
3737
local nodeSelector = nodeAffinity.requiredDuringSchedulingIgnoredDuringExecutionType,
3838
daemonset:
3939
daemonSet.new('node-termination-handler', [self.container]) +
40+
daemonSet.mixin.spec.template.spec.withServiceAccount(self.service_account.metadata.name) +
4041
daemonSet.mixin.spec.template.spec.affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.mixinInstance(
4142
nodeSelector.withNodeSelectorTerms([
4243
nodeSelector.nodeSelectorTermsType.new() +
4344
nodeSelector.nodeSelectorTermsType.withMatchExpressions([
4445
nodeSelector.nodeSelectorTermsType.matchFieldsType
4546
.withKey('cloud.google.com/gke-accelerator')
4647
.withOperator('Exists'),
48+
]),
49+
nodeSelector.nodeSelectorTermsType.new() +
50+
nodeSelector.nodeSelectorTermsType.withMatchExpressions([
4751
nodeSelector.nodeSelectorTermsType.matchFieldsType
4852
.withKey('cloud.google.com/gke-preemptible')
4953
.withOperator('Exists'),

0 commit comments

Comments
 (0)