Skip to content

Commit 0a823a8

Browse files
authored
fix: add default tolerations for collector/eraser pods (#508)
Add default tolerations for collector/eraser pods Issue #503 points out that pods will not be scheduled on nodes with taints, because we do not set any tolerations on the collector or eraser pods. By contrast, daemonsets have default tolerations that enable them to be scheduled on every node regardless of taints. This PR applies those defaults to the collector and eraser pods. Signed-off-by: Peter Engelbert <[email protected]> Signed-off-by: Peter Engelbert <[email protected]>
1 parent 0e83a5c commit 0a823a8

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

controllers/imagejob/imagejob_controller.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,21 @@ var (
5050
successRatio = flag.Float64("job-success-ratio", 1.0, "Ratio of successful/total runs to consider a job successful. 1.0 means all runs must succeed.")
5151
filterNodesSelectors = eraserUtils.MultiFlag([]string{"eraser.sh/cleanup.filter"})
5252
filterOption = flag.String("filter-nodes", "exclude", "operation type (include|exclude) to filter nodes that eraser runs on")
53+
54+
defaultTolerations = []corev1.Toleration{
55+
{
56+
Effect: corev1.TaintEffectNoExecute,
57+
Operator: corev1.TolerationOpExists,
58+
},
59+
{
60+
Effect: corev1.TaintEffectNoSchedule,
61+
Operator: corev1.TolerationOpExists,
62+
},
63+
{
64+
Effect: corev1.TaintEffectPreferNoSchedule,
65+
Operator: corev1.TolerationOpExists,
66+
},
67+
}
5368
)
5469

5570
func init() {
@@ -427,6 +442,7 @@ func copyAndFillTemplateSpec(templateSpecTemplate *corev1.PodSpec, env []corev1.
427442
}
428443

429444
templateSpec := templateSpecTemplate.DeepCopy()
445+
templateSpec.Tolerations = defaultTolerations
430446

431447
eraserImg := &templateSpec.Containers[0]
432448
eraserImg.Args = append(eraserImg.Args, args...)

0 commit comments

Comments
 (0)