fix(driver-k8s): add label selector to sandbox watch stream and list#2223
fix(driver-k8s): add label selector to sandbox watch stream and list#2223rhuss wants to merge 1 commit into
Conversation
…VIDIA#2211) The Kubernetes driver's watch_sandboxes() crashed with a file descriptor leak when non-gateway Sandbox resources (e.g. from SandboxWarmPool) existed in the namespace. The unfiltered watch received events for all Sandbox objects, failed to extract IDs from warm pool objects, and propagated errors that triggered a 2-second reconnect loop leaking HTTP/2 connections until FD exhaustion. Two fixes: - Add openshell.ai/managed-by=openshell label selector to the watcher config and list params so only gateway-managed objects are received. - Defensively skip unrecognized objects with a debug log instead of sending errors to the channel, using let-else for flat control flow. Signed-off-by: Roland Huß <roland@jolokia.org> Signed-off-by: Roland Huß <rhuss@redhat.com>
|
Label |
|
@drew looks like that the GitHub action in #2223 (comment) is a bit broken (at least that |
|
The garbled SHA display ( |
|
/ok to test 664fe92 |
|
@rhuss please have a look at the CI failures; otherwise this LGTM. |
|
The two Rust CI failures are formatting-only. I reproduced them locally on the PR head: After applying rustfmt locally:
No logic changes are needed; running |
|
Label |
Summary
The K8s driver's
watch_sandboxes()crashes with a file descriptor leak when non-gatewaySandboxresources (e.g. fromSandboxWarmPool) exist in the namespace. This adds a label selector to filter at the API server level, and defensively skips unrecognized objects instead of propagating errors to the channel.Related Issue
Fixes #2211
Changes
openshell.ai/managed-by=openshelllabel selector to thewatcher::Configinwatch_sandboxes()so only gateway-managed Sandbox objects generate watch eventsListParamsinlist_sandboxes()so only gateway-managed objects are returnedlet ... elseguards thatdebug!log the object name andcontinue, preventing crash loops from unrecognized objectssandbox_id_from_objectandsandbox_from_objectcovering label extraction, name-prefix fallback, unknown object rejection, and the managed-by-without-sandbox-id edge caseTesting
cargo clippy -p openshell-driver-kubernetes --all-targets -- -D warnings: Cleancargo test -p openshell-driver-kubernetes: 129 passed (123 existing + 6 new)Checklist