console

package
v1.3.0-test Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package console is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConsoleResolver

type AppConsoleResolver interface {
	ResolveConsole(appName, consoleType string) (Session, error)
}

AppConsoleResolver resolves an app name and console type into a ready-to-run Session, or returns an error if the combination is not supported.

type ExecStreamer

type ExecStreamer interface {
	ExecStream(ctx context.Context, containerName string, cmd ...string) (io.ReadWriteCloser, error)
	// Exec runs a short-lived command inside the container (used to reap leftover console clients).
	Exec(ctx context.Context, containerName string, cmd ...string) error
}

ExecStreamer opens an interactive exec session inside a named container, returning the process's stdin/stdout as an io.ReadWriteCloser. *client.Podman satisfies this interface in production; tests may inject a fake.

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager tracks active and inactive app console sessions. It is a pure orchestrator: it calls the resolver to obtain a Session, opens the gRPC stream, and hands the stream to the Session to do the actual I/O. Created and owned by applications.manager.

func NewManager

func NewManager(
	grpcClient grpc_v1.RouterServiceClient,
	deviceName string,
	resolver AppConsoleResolver,
	log *log.PrefixLogger,
) *Manager

func (*Manager) Start

func (m *Manager) Start(ctx context.Context, entry v1beta1.DeviceRemoteSession)

Start is the entry point called by syncConsole for each annotation entry. It resolves the app console, opens the gRPC stream, and runs the session.

func (*Manager) Sync

func (m *Manager) Sync(ctx context.Context, device *v1beta1.Device)

Sync reads the DeviceAnnotationRemoteSession annotation and starts a goroutine for each entry with a non-empty appName that is not already tracked.

func (*Manager) Wait

func (m *Manager) Wait()

Wait blocks until all active sessions have finished. Called during shutdown.

type MockRouterServiceClient

type MockRouterServiceClient struct {
	// contains filtered or unexported fields
}

MockRouterServiceClient is a mock of RouterServiceClient interface.

func NewMockRouterServiceClient

func NewMockRouterServiceClient(ctrl *gomock.Controller) *MockRouterServiceClient

NewMockRouterServiceClient creates a new mock instance.

func (*MockRouterServiceClient) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockRouterServiceClient) Stream

Stream mocks base method.

type MockRouterServiceClientMockRecorder

type MockRouterServiceClientMockRecorder struct {
	// contains filtered or unexported fields
}

MockRouterServiceClientMockRecorder is the mock recorder for MockRouterServiceClient.

func (*MockRouterServiceClientMockRecorder) Stream

func (mr *MockRouterServiceClientMockRecorder) Stream(ctx any, opts ...any) *gomock.Call

Stream indicates an expected call of Stream.

type MockRouterService_StreamClient

type MockRouterService_StreamClient struct {
	// contains filtered or unexported fields
}

MockRouterService_StreamClient is a mock of RouterService_StreamClient interface.

func NewMockRouterService_StreamClient

func NewMockRouterService_StreamClient(ctrl *gomock.Controller) *MockRouterService_StreamClient

NewMockRouterService_StreamClient creates a new mock instance.

func (*MockRouterService_StreamClient) CloseSend

func (m *MockRouterService_StreamClient) CloseSend() error

CloseSend mocks base method.

func (*MockRouterService_StreamClient) Context

Context mocks base method.

func (*MockRouterService_StreamClient) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockRouterService_StreamClient) Header

Header mocks base method.

func (*MockRouterService_StreamClient) Recv

Recv mocks base method.

func (*MockRouterService_StreamClient) RecvMsg

func (m_2 *MockRouterService_StreamClient) RecvMsg(m any) error

RecvMsg mocks base method.

func (*MockRouterService_StreamClient) Send

Send mocks base method.

func (*MockRouterService_StreamClient) SendMsg

func (m_2 *MockRouterService_StreamClient) SendMsg(m any) error

SendMsg mocks base method.

func (*MockRouterService_StreamClient) Trailer

Trailer mocks base method.

type MockRouterService_StreamClientMockRecorder

type MockRouterService_StreamClientMockRecorder struct {
	// contains filtered or unexported fields
}

MockRouterService_StreamClientMockRecorder is the mock recorder for MockRouterService_StreamClient.

func (*MockRouterService_StreamClientMockRecorder) CloseSend

CloseSend indicates an expected call of CloseSend.

func (*MockRouterService_StreamClientMockRecorder) Context

Context indicates an expected call of Context.

func (*MockRouterService_StreamClientMockRecorder) Header

Header indicates an expected call of Header.

func (*MockRouterService_StreamClientMockRecorder) Recv

Recv indicates an expected call of Recv.

func (*MockRouterService_StreamClientMockRecorder) RecvMsg

RecvMsg indicates an expected call of RecvMsg.

func (*MockRouterService_StreamClientMockRecorder) Send

Send indicates an expected call of Send.

func (*MockRouterService_StreamClientMockRecorder) SendMsg

SendMsg indicates an expected call of SendMsg.

func (*MockRouterService_StreamClientMockRecorder) Trailer

Trailer indicates an expected call of Trailer.

type ResolverFunc

type ResolverFunc func(appName, consoleType string) (Session, error)

ResolverFunc is a func adapter for AppConsoleResolver (like http.HandlerFunc). It allows callers to pass an unexported method as a resolver without exposing an exported method on their own type.

func (ResolverFunc) ResolveConsole

func (f ResolverFunc) ResolveConsole(appName, consoleType string) (Session, error)

type Session

type Session interface {
	Run(ctx context.Context, streamClient grpc_v1.RouterService_StreamClient)
}

Session is the per-console-type I/O interface. Each app type (VM, container, …) provides its own implementation.

func NewVMSerialSession

func NewVMSerialSession(containerName string, exec ExecStreamer, log *log.PrefixLogger) Session

NewVMSerialSession returns a Session that bridges the VM's serial socket to the gRPC stream. exec must not be nil; in production pass a *client.Podman, in tests pass a mock ExecStreamer.

func NewVMVNCSession

func NewVMVNCSession(containerName string, exec ExecStreamer, log *log.PrefixLogger) Session

NewVMVNCSession returns a Session that bridges the VM's VNC socket to the gRPC stream. exec must not be nil; in production pass a *client.Podman, in tests pass a mock ExecStreamer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL