vmapi

package
v0.0.0-...-7de36fb Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrQueueFull is returned when the queue is full.
	ErrQueueFull = errors.New("winsize: queue is full")
	// ErrQueueClosed is returned when a channel is full.
	ErrQueueClosed = errors.New("chan is closed, cannot append data")
)

Functions

This section is empty.

Types

type API

type API struct {
	vmproto.UnimplementedAPIServer
	// contains filtered or unexported fields
}

API is the API.

func New

func New(logger *zap.Logger, core Core, dialer Dialer) *API

New creates a new API.

func (*API) CreateExecInPodgRPC

func (a *API) CreateExecInPodgRPC(ctx context.Context, endpoint string, conf *config.KubeExecConfig) error

CreateExecInPodgRPC creates a new exec in pod using gRPC connection to the endpoint agent.

func (*API) ExecCommand

ExecCommand executes a command in the VM.

func (*API) ExecCommandReturnStream

func (a *API) ExecCommandReturnStream(in *vmproto.ExecCommandRequest, srv vmproto.API_ExecCommandReturnStreamServer) error

ExecCommandReturnStream executes a command in the VM and streams the output to the caller. This is useful if the command needs much time to run and we want to log the current state, i.e. kubeadm.

func (*API) ExecCommandStream

func (a *API) ExecCommandStream(srv vmproto.API_ExecCommandStreamServer) error

ExecCommandStream executes a command in the VM and streams the output to the caller. This is useful if the command needs much time to run and we want to log the current state, i.e. kubeadm.

func (*API) ReadFile

ReadFile reads a file and returns its content.

func (*API) WriteFile

WriteFile creates a file and writes output to it.

type Core

type Core interface{}

Core interface contains functions to access the state Core data.

type Dialer

type Dialer interface {
	DialContext(ctx context.Context, network, address string) (net.Conn, error)
}

Dialer is the dial interface. Necessary to stub network connections for local testing with bufconns.

type TerminalSize

type TerminalSize struct {
	Width  uint16
	Height uint16
}

TerminalSize is the struct holding the size data.

type TerminalSizeHandler

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

TerminalSizeHandler stores the Height and Width of a terminal.

func NewTerminalSizeHandler

func NewTerminalSizeHandler(cap int) *TerminalSizeHandler

NewTerminalSizeHandler creates a new Winsize.

func (*TerminalSizeHandler) Close

func (w *TerminalSizeHandler) Close()

Close closes the winsize queue and chan.

func (*TerminalSizeHandler) Fill

func (w *TerminalSizeHandler) Fill(data *TerminalSize) error

Fill appends the data to the queue.

func (*TerminalSizeHandler) Next

func (w *TerminalSizeHandler) Next() *TerminalSize

Next returns the size. The chanel must be served. Otherwise the connection will hang.

type VMAPI

type VMAPI interface {
	CreateExecInPodgRPC(context.Context, string, *config.KubeExecConfig) error
}

VMAPI interface contains functions to access the agent.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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