exec

package
v0.0.0-...-5c47c4c Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: EPL-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActivityTimeOut = 30
)

Variables

This section is empty.

Functions

func GetNamespace

func GetNamespace() string

Get namespace for current Eclipse CHE workspace

Types

type CmdResolver

CmdResolver resolves exec command - MachineExec#Cmd. Needed to patch command to apply some features which missed up in the original kubernetes exec api.

func NewCmdResolver

func NewCmdResolver(k8sAPI *client.K8sAPI, namespace string) *CmdResolver

NewCmdResolver creates new instance CmdResolver.

func (*CmdResolver) ResolveCmd

func (cmdRslv *CmdResolver) ResolveCmd(exec model.MachineExec, containerInfo *model.ContainerInfo) (resolvedCmd []string, err error)

Gets original command from exec model(MachineExec#Cmd) and returns patched command to support some features which original kubernetes api doesn't provide.

type ExecManager

type ExecManager interface {
	// Resolve resolves exec info
	// the first container with available shell will be picked up if omit
	Resolve(container, token string) (*model.ResolvedExec, error)

	// Create new Exec defined by machine exec model object.
	Create(machineExec *model.MachineExec) (int, error)

	// Remove information about exec by ExecId.
	// It's can be useful in case exec error or exec exit.
	Remove(execId int)

	// Check if exec with current id is exists
	Check(id int) (int, error)

	// Attach simple websocket connection to the exec stdIn/stdOut by unique exec id.
	Attach(id int, conn *websocket.Conn) error

	// Resize exec by unique id.
	Resize(id int, cols uint, rows uint) error

	// Create a kubeconfig
	CreateKubeConfig(kubeConfigParams *model.KubeConfigParams, containerInfo *model.ContainerInfo) error

	// List available containers
	ListAvailableContainers(machineExec *model.MachineExec) ([]*model.ContainerInfo, error)
}

ExecManager to manage exec life cycle.

func CreateExecManager

func CreateExecManager() (exeManager ExecManager)

CreateExecManager creates and returns new instance ExecManager. Fail with panic if it is impossible.

func GetExecManager

func GetExecManager() ExecManager

GetExecManager returns instance exec manager

type HealthWatcher

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

Exec health watcher. This watcher cleans up exec resources and sends notification to the subscribed clients in case exec error or exit.

func NewHealthWatcher

func NewHealthWatcher(exec *model.MachineExec, eventBus *event.Bus, manager ExecManager) *HealthWatcher

Create new exec health watcher

func (*HealthWatcher) CleanUpOnExitOrError

func (watcher *HealthWatcher) CleanUpOnExitOrError()

Look at the exec health and clean up application on exec exit/error, sent exit/error event to the subscribed clients

type KubernetesExecManager

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

KubernetesExecManager manipulate kubernetes container execs.

func NewK8sExecManager

func NewK8sExecManager(
	namespace string,
	clientProvider client.K8sAPIProvider,
) *KubernetesExecManager

Newk8sExecManager create new instance of the kubernetes exec manager.

func (*KubernetesExecManager) Attach

func (*KubernetesExecManager) Attach(id int, conn *websocket.Conn) error

Attach websoket connection to the exec by id.

func (*KubernetesExecManager) Check

func (*KubernetesExecManager) Check(id int) (int, error)

Check if exec with id exists

func (*KubernetesExecManager) Create

func (manager *KubernetesExecManager) Create(machineExec *model.MachineExec) (int, error)

Create new exec request object

func (*KubernetesExecManager) CreateKubeConfig

func (manager *KubernetesExecManager) CreateKubeConfig(kubeConfigParams *model.KubeConfigParams, containerInfo *model.ContainerInfo) error

func (*KubernetesExecManager) ListAvailableContainers

func (manager *KubernetesExecManager) ListAvailableContainers(machineExec *model.MachineExec) (containersInfo []*model.ContainerInfo, err error)

List available containers

func (*KubernetesExecManager) Remove

func (*KubernetesExecManager) Remove(execID int)

Remove information about exec

func (*KubernetesExecManager) Resize

func (*KubernetesExecManager) Resize(id int, cols uint, rows uint) error

Resize exec output frame.

func (*KubernetesExecManager) Resolve

func (manager *KubernetesExecManager) Resolve(container, token string) (*model.ResolvedExec, error)

type PtyHandlerImpl

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

Kubernetes pty handler

func CreatePtyHandlerImpl

func CreatePtyHandlerImpl(machineExec *model.MachineExec, filter *utf8stream.Utf8StreamFilter) *PtyHandlerImpl

func (PtyHandlerImpl) Next

func (PtyHandlerImpl) Read

func (t PtyHandlerImpl) Read(p []byte) (int, error)

func (PtyHandlerImpl) Write

func (t PtyHandlerImpl) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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