added log on failure to attach
Some checks failed
Build and Push Docker Image / Build image (push) Has been cancelled

This commit is contained in:
ACoolName 2025-04-09 16:45:18 +03:00
parent c647f76894
commit 4ffaabd6e6

View File

@ -3,6 +3,7 @@ package kubernetes
import (
"context"
"io"
"log"
"os"
"path/filepath"
"strings"
@ -250,8 +251,8 @@ func (i *InstanceManager) InteractiveTerminal(ctx context.Context, serverId stri
req := i.coreV1Cli.CoreV1().RESTClient().
Post().
Resource("pods").
Namespace(i.Config.Namespace).
Name(serverId).
Namespace(i.Config.Namespace).
SubResource("attach").
VersionedParams(&corev1.PodAttachOptions{
Stdin: true,
@ -264,7 +265,10 @@ func (i *InstanceManager) InteractiveTerminal(ctx context.Context, serverId stri
go func() {
defer stdoutWriter.Close()
defer stdinReader.Close()
_ = executor.StreamWithContext(ctx, remotecommand.StreamOptions{Stdin: stdinReader, Stdout: stdoutWriter, Stderr: stdoutWriter, Tty: true, TerminalSizeQueue: queue})
err := executor.StreamWithContext(ctx, remotecommand.StreamOptions{Stdin: stdinReader, Stdout: stdoutWriter, Stderr: stdoutWriter, Tty: true, TerminalSizeQueue: queue})
if err != nil {
log.Printf("Failed to attach %e", err)
}
}()
if err != nil {