Skip to content

kubernetes executor: support node selector and tolerations - #2

Merged
zapo merged 2 commits into
masterfrom
feat/kube-nodeselector-tolerations
Aug 4, 2026
Merged

kubernetes executor: support node selector and tolerations#2
zapo merged 2 commits into
masterfrom
feat/kube-nodeselector-tolerations

Conversation

@zapo

@zapo zapo commented Jul 27, 2026

Copy link
Copy Markdown
Member

Adds two flags to the kubernetes executor so run Jobs can be pinned to a dedicated (and typically tainted) node pool, instead of scheduling anywhere in the cluster.

Changes

  • --kubernetes-node-selector — repeatable name=value, sets PodSpec.NodeSelector.
  • --kubernetes-tolerations — repeatable key[=value]:effect (kubectl-taint syntax; operator is Exists when no value, else Equal; empty effect tolerates all effects), sets PodSpec.Tolerations.

Both are parsed in newKubeExecutor (consistent with the existing --kubernetes-labels handling) and applied to the Job pod template.

Why

Lets terraform plan/apply pods target an isolated node pool so cluster-autoscaler can scale that pool with run volume, keeping the per-run CPU off shared nodes. The kubernetes executor previously exposed no scheduling controls (no nodeSelector/tolerations/affinity), and GKE does not expose the PodNodeSelector/PodTolerationRestriction admission plugins to do this cluster-side.

Testing

  • go build ./internal/runner/ and go vet ./internal/runner/ pass.
  • Unit tests added: valid/invalid node selectors, toleration parsing (Equal/Exists, invalid effect, empty key), and assertions that both land on the generated pod spec. go test ./internal/runner/ -run TestNewKubeExecutor|TestKubeExecutor_SpawnOperation passes.

zapo added 2 commits July 27, 2026 14:38
Add --kubernetes-node-selector and --kubernetes-tolerations flags so
run jobs can be pinned to a dedicated/tainted node pool. Tolerations
use the kubectl-taint syntax key[=value]:effect (Exists when no value).
Expose the new --kubernetes-node-selector and --kubernetes-tolerations
flags through the otfd and otf-agent helm charts (via the runner
library), regenerate READMEs, bump chart versions, and document the
flags in flags.md and executors.md.
@zapo

zapo commented Jul 27, 2026

Copy link
Copy Markdown
Member Author

Superseded by the upstream draft PR leg100#973 (same branch feat/kube-nodeselector-tolerations). Closing this fork-internal PR; reopen if we decide to carry the change in the fork independently of upstream.

@zapo zapo closed this Jul 27, 2026
@zapo zapo reopened this Aug 4, 2026
@zapo
zapo marked this pull request as ready for review August 4, 2026 19:56
@zapo
zapo merged commit ba54173 into master Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant