mirror of
https://github.com/open-webui/terminals.git
synced 2026-11-05 01:37:21 +00:00
[PR #61] [CLOSED] Re-create terminal pods that disappear, and stop serving dead ones #62
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
open-webui/terminals#62
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/terminals/pull/61
Author: @joshhuyn
Created: 9/16/2026
Status: ❌ Closed
Base:
main← Head:recreate-resources📝 Commits (1)
0b03591Re-create terminal pods that disappear, and stop serving dead ones📊 Changes
6 files changed (+963 additions, -208 deletions)
View changed files
📝
CHANGELOG.md(+13 -0)📝
README.md(+11 -0)📝
operator/handler.py(+395 -119)📝
terminals/backends/kubernetes_operator.py(+105 -89)📝
terminals/config.py(+3 -0)➕
tests/test_operator_reconcile.py(+436 -0)📄 Description
#60
on.create, so a pod that was deleted, evicted, or lost with its node stayed gone while theTerminalstill reportedphase: Running— the orchestrator kept proxying to a Service with no endpoints until the session was abandoned. Child creation moved into a level-triggered_ensure_children, now shared byon.create, akopf.timerreconcile loop (TERMINALS_RECONCILE_INTERVAL_SECONDS, default 15),on.resumeso restarts re-adopt existing CRs, and the pod-DELETED watcher. Succeeded/Failed pods are deleted first so the next pass can replace them.idle_checknow marks the CRIdlebefore deleting the pod, reconcile skipsIdle, and_ensure_childrenre-reads the live phase through a guard right before touching the pod so a sweep running off a stale cache cannot undo a cull._ensure_secretreads the api-key back out of an existing Secret, so a re-created pod keeps the credential the orchestrator already handed out instead of coming up with a key nobody holds._patch_terminal_status, which sendsapplication/merge-patch+json. The client otherwise defaults toapplication/json-patch+jsonand rejects a dict body, so pod state could silently fail to reach the resource.deletionTimestampreports Running and ready for its whole termination grace period; it is no longer advertised as usable.TERMINALS_KUBERNETES_NODE_SELECTORandTERMINALS_KUBERNETES_TOLERATIONSare parsed once fromconfigure()and cached, rather than on every_build_pod_manifestcall. Both raise on malformed input, and the reconcile loop rebuilds manifests every sweep for every Terminal, so a single typo would otherwise mean no pod is ever created and the same traceback repeats forever. They come from the operator's own environment and cannot change while it runs, so a bad value now stops the operator at startup with an error naming the variable and the expected shape instead of degrading into a silent never-schedules state.kubernetes-operatorbackend judges readiness by theReadycondition rather thanphasealone (_is_serving), and re-creates aTerminalthat never becomes ready instead of failing every request from then on. The wait is bounded by the newTERMINALS_TERMINAL_READY_TIMEOUT(default 120) and returns early if the CR vanishes mid-wait. Duplicated connect/cache bookkeeping inensure_terminalcollapsed into_connect_info/_remember/_reprovision.tests/test_operator_reconcile.pycovers the reconcile, pod-event and scheduling-config paths against stubbed kopf/kubernetes clients.Description
Related Issues
Contributor License Agreement
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.