Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): console,vnc reconnect #553

Merged
merged 8 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading