Skip to content

Commit

Permalink
feat(api): console,vnc reconnect (#553)
Browse files Browse the repository at this point in the history
* feat(api): console,vnc reconnect

Signed-off-by: Daniil Antoshin <[email protected]>
  • Loading branch information
danilrwx authored Dec 5, 2024
1 parent 6f05a20 commit b0501a9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ tasks:

dlv:virt-handler:build:
desc: "Build image virt-handler with dlv"
cmd: docker build -f ./images/virt-handler/debug/dlv.Dockerfile -t "{{ .DLV_IMAGE }}" .
cmd: docker build -f ./images/virt-handler/debug/dlv.Dockerfile -t "{{ .DLV_IMAGE }}" --platform linux/amd64 .

dlv:virt-handler:build-push:
desc: "Build and Push image virt-handler with dlv"
Expand Down
23 changes: 23 additions & 0 deletions images/virt-artifact/patches/025-stream-graceful-shutdown.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
diff --git a/pkg/virt-handler/rest/console.go b/pkg/virt-handler/rest/console.go
index 4eb681018d..f76f6187a7 100644
--- a/pkg/virt-handler/rest/console.go
+++ b/pkg/virt-handler/rest/console.go
@@ -43,6 +43,8 @@ import (

"kubevirt.io/kubevirt/pkg/util"
"kubevirt.io/kubevirt/pkg/virt-handler/isolation"
+
+ "github.com/gorilla/websocket"
)

//const failedRetrieveVMI = "Failed to retrieve VMI"
@@ -326,7 +328,7 @@ func (t *ConsoleHandler) stream(vmi *v1.VirtualMachineInstance, request *restful

select {
case <-stopCh:
- break
+ clientSocket.WriteMessage(websocket.CloseMessage, websocket.FormatCloseMessage(websocket.CloseGoingAway, "close by another connection"))
case err := <-errCh:
if err != nil && err != io.EOF {
log.Log.Object(vmi).Reason(err).Error("Error in proxing websocket and unix socket")

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21.8-bookworm@sha256:ac14cc827536ef1a124cd2f7a03178c3335c1db8ad3807e7fdd57f74096abfa0 AS builder
FROM golang:1.22.8-bookworm@sha256:3f0457a0a56a926d93c2baf4cf0057a645e8ff69ff31314080fcc62389643b8e AS builder
ARG TARGETOS
ARG TARGETARCH

Expand Down

0 comments on commit b0501a9

Please sign in to comment.