[PR #30] [CLOSED] Add Kubernetes scheduling overrides for terminal pods #54

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/30
Author: @phillamb168
Created: 7/1/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

Summary

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

🔄 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/30 **Author:** [@phillamb168](https://github.com/phillamb168) **Created:** 7/1/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 ## Summary 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 --- <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#54
No description provided.