[PR #14] [MERGED] fix: ensure label consistency between backend types #46

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

📋 Pull Request Information

Original PR: https://github.com/open-webui/terminals/pull/14
Author: @james-westbrook
Created: 3/29/2026
Status: ✅ Merged
Merged: 3/29/2026
Merged by: @tjbck

Base: main ← Head: fix-label-consistency


📝 Commits (1)

  • fd3ca8b fix: ensure label consistency between backend types and across user-specific resources

📊 Changes

1 file changed (+23 additions, -15 deletions)

View changed files

📝 operator/handler.py (+23 -15)

📄 Description

Description

Fixes label inconsistency between backends & adds user-id labels to operator resources.

Problem

The kubernetes-operator backend used a different managed-by label value than every other backend:

Backend app.kubernetes.io/managed-by
kubernetes terminals
docker terminals
kubernetes-operator (CRs) terminals
operator child resources (pods, services, secrets, PVCs) open-terminal-operator ← mismatch

This meant cross-backend queries filtered on managed-by=terminals would miss operator-created pods.

Additionally, operator-created resources were missing two useful labels:

  • app.kubernetes.io/part-of — not set at all
  • openwebui.com/user-id — present on resources from other backends but absent from operator-created ones

Root Cause

The operator's _labels() helper in handler.py hard-coded managed-by: open-terminal-operator and had no access to the user ID from the Terminal CR spec.

Fix

operator/handler.py

  1. Changed managed-by from open-terminal-operator to terminals to align with all other backends.
  2. Added part-of: open-terminal label.
  3. Added optional user_id parameter to _labels() — when provided, emits openwebui.com/user-id on every child resource (pod, service, secret, PVC).
  4. Threaded user_id from the Terminal CR spec through all four _build_*_manifest() functions and their call sites in on_create().
  5. Updated the pod-watcher event filter from managed-by=open-terminal-operator to managed-by=terminals.

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/14 **Author:** [@james-westbrook](https://github.com/james-westbrook) **Created:** 3/29/2026 **Status:** ✅ Merged **Merged:** 3/29/2026 **Merged by:** [@tjbck](https://github.com/tjbck) **Base:** `main` ← **Head:** `fix-label-consistency` --- ### 📝 Commits (1) - [`fd3ca8b`](https://github.com/open-webui/terminals/commit/fd3ca8b01bcdf6e1ed28ce0c4e58180ab7514b26) fix: ensure label consistency between backend types and across user-specific resources ### 📊 Changes **1 file changed** (+23 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `operator/handler.py` (+23 -15) </details> ### 📄 Description ## Description Fixes label inconsistency between backends & adds user-id labels to operator resources. ## Problem The `kubernetes-operator` backend used a different `managed-by` label value than every other backend: | Backend | `app.kubernetes.io/managed-by` | |---|---| | `kubernetes` | `terminals` | | `docker` | `terminals` | | `kubernetes-operator` (CRs) | `terminals` | | **operator child resources** (pods, services, secrets, PVCs) | **`open-terminal-operator`** ← mismatch | This meant cross-backend queries filtered on `managed-by=terminals` would miss operator-created pods. Additionally, operator-created resources were missing two useful labels: - `app.kubernetes.io/part-of` — not set at all - `openwebui.com/user-id` — present on resources from other backends but absent from operator-created ones ## Root Cause The operator's `_labels()` helper in `handler.py` hard-coded `managed-by: open-terminal-operator` and had no access to the user ID from the Terminal CR spec. ## Fix **`operator/handler.py`** 1. Changed `managed-by` from `open-terminal-operator` to `terminals` to align with all other backends. 2. Added `part-of: open-terminal` label. 3. Added optional `user_id` parameter to `_labels()` — when provided, emits `openwebui.com/user-id` on every child resource (pod, service, secret, PVC). 4. Threaded `user_id` from the Terminal CR spec through all four `_build_*_manifest()` functions and their call sites in `on_create()`. 5. Updated the pod-watcher event filter from `managed-by=open-terminal-operator` to `managed-by=terminals`. ## Related Issues <!-- Link any related issues: Fixes #123, Closes #456 --> --- ## 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:46 +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#46
No description provided.