Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(supervisor): add k8 worker pod priority class support #2631

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
NERLOE wants to merge 2 commits into triggerdotdev:main
base: main
Choose a base branch
Loading
from NERLOE:feat/worker-pod-priority-class-support

Conversation

@NERLOE
Copy link
Contributor

@NERLOE NERLOE commented Oct 24, 2025

Add KUBERNETES_WORKER_PRIORITY_CLASS_NAME environment variable to allow configuring a priority class for task run pods in Kubernetes environments.

This addresses pod preemption issues in resource-constrained clusters, particularly in GKE Autopilot where low-priority pods can be preempted by system pods during scale-up operations.

Closes #2630

✅ Checklist

  • I have followed every step in the contributing guide
  • The PR title follows the convention.
  • I ran and tested the code works

Testing

Added example configuration and tested assignment of priority class on our worker pods in our GKE Autopilot production cluster.

supervisor:
 extraEnvVars:
 - name: KUBERNETES_WORKER_PRIORITY_CLASS_NAME
 value: "trigger-task-runs"
extraManifests:
 - apiVersion: scheduling.k8s.io/v1
 kind: PriorityClass
 metadata:
 name: trigger-task-runs
 value: 100000
 globalDefault: false

Changelog

  • Added: KUBERNETES_WORKER_PRIORITY_CLASS_NAME environment variable to apps/supervisor/src/env.ts
  • Added: Support for priorityClassName in Kubernetes pod spec (apps/supervisor/src/workloadManager/kubernetes.ts)
  • Enhancement: Worker pods can now be configured with priority classes to prevent preemption in resource-constrained environments
  • Compatibility: Fully backward compatible - optional configuration with no breaking changes

Screenshots

N/A - Infrastructure/backend change. Configuration can be verified via:

# Verify priority class is applied to new worker pods
kubectl get pods -n trigger -l app=task-run \
 -o custom-columns=NAME:.metadata.name,PRIORITY:.spec.priority,PRIORITY_CLASS:.spec.priorityClassName

Expected output after configuration:

NAME PRIORITY PRIORITY_CLASS
runner-cmh4xxxxx 100000 trigger-task-runs

NikolajRask and aarhusgregersen reacted with thumbs up emoji torbenal and aarhusgregersen reacted with heart emoji
Copy link

changeset-bot bot commented Oct 24, 2025
edited
Loading

⚠️ No Changeset found

Latest commit: 9045e31

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

coderabbitai bot commented Oct 24, 2025
edited
Loading

Walkthrough

This change adds an optional environment variable KUBERNETES_WORKER_PRIORITY_CLASS_NAME to the Env schema in apps/supervisor/src/env.ts. The workload manager in apps/supervisor/src/workloadManager/kubernetes.ts is updated to conditionally include priorityClassName in the default Kubernetes pod spec when that environment variable is defined. No other control flow or API changes were made.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Changes are limited to two related files and follow a consistent, simple pattern (schema addition + conditional usage).
  • Areas to inspect:
    • apps/supervisor/src/env.ts — ensure schema validation and any env loading still behave as expected.
    • apps/supervisor/src/workloadManager/kubernetes.ts — verify the priorityClassName is injected correctly and that pod spec shape remains valid when the variable is undefined.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Title Check ✅ Passed The PR title "feat(supervisor): add k8 worker pod priority class support" follows the conventional commit format with a clear scope and descriptive action. It accurately summarizes the primary change in the changeset—adding Kubernetes priority class configuration support for worker pods. The title is concise, specific, and would clearly communicate the main change to teammates reviewing the Git history.
Linked Issues Check ✅ Passed The code changes fully implement the requirements from issue #2630 [#2630]. The PR adds the KUBERNETES_WORKER_PRIORITY_CLASS_NAME environment variable as an optional configuration in env.ts and implements priorityClassName support in the Kubernetes pod spec through kubernetes.ts. Both changes directly address the stated objective of allowing operators to configure priority classes for task run pods to prevent preemption in resource-constrained clusters like GKE Autopilot. The implementation is backward compatible and optional as required, with no breaking changes introduced.
Out of Scope Changes Check ✅ Passed All changes in the pull request are directly scoped to the objectives defined in issue #2630. The modifications to apps/supervisor/src/env.ts and apps/supervisor/src/workloadManager/kubernetes.ts serve exclusively to implement priority class configuration support for worker pods. There are no unrelated refactorings, unintended modifications, or changes to other functionality beyond what is necessary to enable the priorityClassName feature described in the linked issue.
Description Check ✅ Passed The PR description fully adheres to the repository template, including all required sections: it closes issue #2630, contains a completed checklist confirming the contributing guide was followed and code was tested, provides comprehensive testing details with example YAML configuration and kubectl verification commands, includes a detailed changelog documenting the specific files changed and their purpose, and appropriately notes that screenshots are N/A with an alternative verification method. The description is well-structured, informative, and provides clear context about why this change addresses pod preemption issues in GKE Autopilot.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7a77c9f and 9045e31.

📒 Files selected for processing (2)
  • apps/supervisor/src/env.ts (1 hunks)
  • apps/supervisor/src/workloadManager/kubernetes.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/supervisor/src/env.ts
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Always prefer using isomorphic code like fetch, ReadableStream, etc. instead of Node.js specific code
For TypeScript, we usually use types over interfaces
Avoid enums
No default exports, use function declarations

Files:

  • apps/supervisor/src/workloadManager/kubernetes.ts
🧬 Code graph analysis (1)
apps/supervisor/src/workloadManager/kubernetes.ts (1)
apps/supervisor/src/env.ts (1)
  • env (120-120)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (22)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (7, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (6, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (8, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (5, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (4, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (3, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (2, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (1, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (7, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (2, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (8, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (4, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (5, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (6, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (3, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (1, 8)
  • GitHub Check: units / packages / 🧪 Unit Tests: Packages (1, 1)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - pnpm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - npm)
  • GitHub Check: typecheck / typecheck
🔇 Additional comments (1)
apps/supervisor/src/workloadManager/kubernetes.ts (1)

289-293: LGTM! Clean implementation following established patterns.

The conditional inclusion of priorityClassName is correctly implemented and follows the same pattern as the existing optional fields (schedulerName and nodeSelector). The change is backward compatible and addresses the pod preemption issue described in #2630.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

NERLOE added 2 commits October 28, 2025 09:18
Add KUBERNETES_POD_PRIORITY_CLASS_NAME environment variable to allow
configuring a priority class for task run pods in Kubernetes environments.
This addresses pod preemption issues in resource-constrained clusters,
particularly in GKE Autopilot where low-priority pods can be preempted
by system pods during scale-up operations.
Fixes: Pod preemption causing SIGTERM failures during cluster scale-up
Related: GKE Autopilot resource contention
@NERLOE NERLOE force-pushed the feat/worker-pod-priority-class-support branch from 7a77c9f to 9045e31 Compare October 28, 2025 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

feat: add support for configuring worker pod priority class

1 participant

AltStyle によって変換されたページ (->オリジナル) /