Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: olexii4 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Docker image build succeeded: quay.io/eclipse/che-dashboard:pr-1475 kubectl patch commandkubectl patch -n eclipse-che "checluster/eclipse-che" --type=json -p="[{"op": "replace", "path": "/spec/components/dashboard/deployment", "value": {containers: [{image: "quay.io/eclipse/che-dashboard:pr-1475", name: che-dashboard}]}}]" |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1475 +/- ##
==========================================
+ Coverage 93.35% 93.39% +0.03%
==========================================
Files 562 563 +1
Lines 54290 54431 +141
Branches 4114 4130 +16
==========================================
+ Hits 50681 50834 +153
+ Misses 3565 3553 -12
Partials 44 44 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Docker image build succeeded: quay.io/eclipse/che-dashboard:pr-1475 kubectl patch commandkubectl patch -n eclipse-che "checluster/eclipse-che" --type=json -p="[{"op": "replace", "path": "/spec/components/dashboard/deployment", "value": {containers: [{image: "quay.io/eclipse/che-dashboard:pr-1475", name: che-dashboard}]}}]" |
The frontend WebSocket handler fired injectKubeConfig and podmanLogin HTTP requests when a workspace reached Running status. Because the browser simultaneously navigates to the IDE URL, those requests were cancelled when the Dashboard ran in a single tab. Move the injection trigger to the backend PATCH route: when a patch sets spec.started=true, a PostStartInjector watches the DevWorkspace via the Kubernetes Watch API and calls injectKubeConfig/podmanLogin server-side once the workspace reaches Running. The watcher auto- cleans up on success, Failed phase, or a 60-second timeout, and prevents duplicate subscriptions per workspace. Fixes eclipse-che/che#23694 Assisted-by: Cursor Signed-off-by: Oleksii Orel <oorel@redhat.com>
|
Docker image build succeeded: quay.io/eclipse/che-dashboard:pr-1475 kubectl patch commandkubectl patch -n eclipse-che "checluster/eclipse-che" --type=json -p="[{"op": "replace", "path": "/spec/components/dashboard/deployment", "value": {containers: [{image: "quay.io/eclipse/che-dashboard:pr-1475", name: che-dashboard}]}}]" |
What does this PR do?
This PR fixes a race condition where
injectKubeConfigandpodmanLoginAPI requests are cancelled by the browser when the Dashboard navigates to the IDE URL (eclipse-che/che#23694).When a workspace transitions to
RUNNINGstatus, the Dashboard frontend simultaneously fires background API calls (injectKubeConfig,podmanLogin) and navigates the browser to the IDE URL. When the Dashboard runs in a single browser tab, the browser cancels all pending HTTP requests upon navigation, causing the kubeconfig and podman credentials to never be injected into workspace containers.The fix moves the injection trigger from the frontend WebSocket handler to the backend PATCH route, where it runs server-side and is not affected by browser navigation.
The Race Condition (before this fix)
Key Changes:
PostStartInjectorservice — New server-side service that watches a specific DevWorkspace via the Kubernetes Watch API after it is started and injects kubeconfig + podman credentials once it reaches theRunningphase. Contains:watchAndInjectstatic method — Starts a per-workspace Kubernetes watch keyed bynamespace/nameFailedphase, 60-second timeout, or watch errordevworkspaces.tsPATCH route update — When the PATCH request setsspec.started: true, the route triggersPostStartInjector.watchAndInject()to begin monitoring the workspace server-sidegetKubeConfighelper — New helper that returns aKubeConfigconfigured with the user's token, needed by the Kubernetes Watch APIgetDevWorkspaceClientmock update — AddedpodmanApimock andgetKubeConfigmock for test coveragedevworkspaces.spec.tstest update — AddedPostStartInjectormock to backend route testshandleWebSocketMessage.tsupdate — Removed theinjectKubeConfig/podmanLoginblock and related imports from the frontend WebSocket message handlerhandleWebSocketMessage.spec.tstest update — Removed tests that verified the (now-removed) frontend injection behaviorBehavior:
spec.started: true)[{op: "replace", path: "/spec/started", value: true}]PostStartInjectorcreates a Kubernetes watch, waits forRunning, injects kubeconfig + podman loginRunninginjectKubeConfigandpodmanLogincalled server-side, watcher unsubscribesFailedphaseRunningwithin 60snamespace/namekey)[{op: "replace", path: "/metadata/annotations", ...}]Note: The frontend no longer triggers
injectKubeConfigorpodmanLogin. All injection is handled server-side by the backend process, which is long-lived and unaffected by browser navigation.Screenshot/screencast of this PR
N/A — backend-only behavioral change, no UI modifications.
What issues does this PR fix or reference?
fixes eclipse-che/che#23694
Is it tested? How?
Deploy Eclipse Che with the image from this PR.
Test KubeConfig and Podman Injection (single tab):
{che-server}/dashboard/RUNNING, the browser should navigate to the IDE without cancelling any requestsVerify:
kubeconfigorpodmanloginPOST requests appear in the browser Network tab (they now happen server-side)kubectl get podsworks inside the workspace terminal (kubeconfig was injected)podman loginto the OpenShift internal registry succeeds (podman credentials were injected)PostStartInjectormessages confirming successful injection:Test timeout / failure scenarios:
PostStartInjectorshould log abort onFailedphaseRelease Notes
fix:
injectKubeConfigandpodmanLoginnow execute server-side when a workspace starts, preventing request cancellation when the browser navigates to the IDE URL (eclipse-che/che#23694)Docs PR
N/A