[PR #32] [CLOSED] Add Kubernetes scheduling overrides for terminal pods #55

Closed
opened 2026-10-18 21:13:50 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/terminals/pull/32
Author: @phillamb168
Created: 7/2/2026
Status: ❌ Closed

Base: main ← Head: feat/kubernetes-scheduling-overrides


📝 Commits (1)

  • 761aff2 Add Kubernetes scheduling overrides for terminal pods

📊 Changes

3 files changed (+52 additions, -0 deletions)

View changed files

📝 README.md (+2 -0)
📝 operator/handler.py (+25 -0)
📝 terminals/backends/kubernetes_operator.py (+25 -0)

📄 Description

Description

(Previous PR was closed for CLA; CLA has now been completed. Sorry about that.)
Adds optional Kubernetes scheduling overrides for the kubernetes-operator backend.

This allows cluster operators to configure generated terminal pods and reset pods with:

  • TERMINALS_KUBERNETES_NODE_SELECTOR
  • TERMINALS_KUBERNETES_TOLERATIONS

Both values are JSON-encoded environment variables. If unset, behavior is unchanged.

Problem

The Kubernetes operator backend currently supports per-terminal images, resources, environment, persistence, and storage class selection, but it does not expose a way for cluster operators to constrain where generated terminal pods run.

For multi-tenant or resource-isolated deployments, operators may need terminal pods to run only on a dedicated node pool. A common example is isolating user terminal workloads from stateful platform services by using Kubernetes node labels and taints.

Without this, generated terminal pods can schedule onto any eligible cluster node.

Solution

This PR adds a small, opt-in scheduling override path:

  • The operator reads TERMINALS_KUBERNETES_NODE_SELECTOR and applies it to generated terminal pod specs as nodeSelector.
  • The operator reads TERMINALS_KUBERNETES_TOLERATIONS and applies it to generated terminal pod specs as tolerations.
  • The Terminals service reads the same values and applies them to generated reset pods.

Invalid JSON is ignored with a warning, preserving existing behavior.

Example

TERMINALS_KUBERNETES_NODE_SELECTOR='{"example.com/node-pool":"terminals"}'
TERMINALS_KUBERNETES_TOLERATIONS='[{"key":"example.com/node-pool","operator":"Equal","value":"terminals","effect":"NoSchedule"}]'

Compatibility

This is backwards compatible. If the environment variables are not set, generated pod specs are unchanged.

Testing

  • Verified the patch applies cleanly.
  • Intended deployment target is a Kubernetes cluster using a tainted dedicated node pool for terminal workloads.
  • Manual cluster validation plan:
    • create a terminal
    • confirm generated terminal pod has the expected nodeSelector
    • confirm generated terminal pod has the expected tolerations
    • confirm pod schedules only on the intended node pool
    • confirm reset pod uses the same scheduling overrides

Fixes #31


Contributor License Agreement

Note

Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/terminals/pull/32 **Author:** [@phillamb168](https://github.com/phillamb168) **Created:** 7/2/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/kubernetes-scheduling-overrides` --- ### 📝 Commits (1) - [`761aff2`](https://github.com/open-webui/terminals/commit/761aff261e498ad82d1745155c6d759d3e7bbdb0) Add Kubernetes scheduling overrides for terminal pods ### 📊 Changes **3 files changed** (+52 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+2 -0) 📝 `operator/handler.py` (+25 -0) 📝 `terminals/backends/kubernetes_operator.py` (+25 -0) </details> ### 📄 Description ## Description (Previous PR was closed for CLA; CLA has now been completed. Sorry about that.) Adds optional Kubernetes scheduling overrides for the `kubernetes-operator` backend. This allows cluster operators to configure generated terminal pods and reset pods with: - `TERMINALS_KUBERNETES_NODE_SELECTOR` - `TERMINALS_KUBERNETES_TOLERATIONS` Both values are JSON-encoded environment variables. If unset, behavior is unchanged. ## Problem The Kubernetes operator backend currently supports per-terminal images, resources, environment, persistence, and storage class selection, but it does not expose a way for cluster operators to constrain where generated terminal pods run. For multi-tenant or resource-isolated deployments, operators may need terminal pods to run only on a dedicated node pool. A common example is isolating user terminal workloads from stateful platform services by using Kubernetes node labels and taints. Without this, generated terminal pods can schedule onto any eligible cluster node. ## Solution This PR adds a small, opt-in scheduling override path: - The operator reads `TERMINALS_KUBERNETES_NODE_SELECTOR` and applies it to generated terminal pod specs as `nodeSelector`. - The operator reads `TERMINALS_KUBERNETES_TOLERATIONS` and applies it to generated terminal pod specs as `tolerations`. - The Terminals service reads the same values and applies them to generated reset pods. Invalid JSON is ignored with a warning, preserving existing behavior. ### Example ```bash TERMINALS_KUBERNETES_NODE_SELECTOR='{"example.com/node-pool":"terminals"}' TERMINALS_KUBERNETES_TOLERATIONS='[{"key":"example.com/node-pool","operator":"Equal","value":"terminals","effect":"NoSchedule"}]' ``` ### Compatibility This is backwards compatible. If the environment variables are not set, generated pod specs are unchanged. ### Testing - Verified the patch applies cleanly. - Intended deployment target is a Kubernetes cluster using a tainted dedicated node pool for terminal workloads. - Manual cluster validation plan: - create a terminal - confirm generated terminal pod has the expected nodeSelector - confirm generated terminal pod has the expected tolerations - confirm pod schedules only on the intended node pool - confirm reset pod uses the same scheduling overrides ## Related Issues Fixes #31 --- ## Contributor License Agreement <!-- 🚨 DO NOT DELETE THE TEXT BELOW 🚨 Keep the "Contributor License Agreement" confirmation text intact. Deleting it will trigger the CLA-Bot to INVALIDATE your PR. Your PR will NOT be reviewed or merged until you check the box below confirming that you have read and agree to the terms of the CLA. --> - [X] By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](./CLA.md), and I am providing my contributions under its terms. > [!NOTE] > Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-18 21:13:50 +00:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
open-webui/terminals#55
No description provided.