tunnel

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockTunnel added in v0.2.0

type MockTunnel struct {
	sync.Mutex
	OnNodeDiscovered
	OnNodeStatusDataArrived
	OnSingleContainerStatusChanged
	OnQueryAllContainerStatusDataArrived

	NodeNotReady map[string]bool
	// contains filtered or unexported fields
}

func (*MockTunnel) DeleteNode added in v0.2.0

func (m *MockTunnel) DeleteNode(nodeID string)

func (*MockTunnel) FetchHealthData added in v0.2.0

func (m *MockTunnel) FetchHealthData(ctx context.Context, nodeID string) error

func (*MockTunnel) GetContainerUniqueKey added in v0.2.0

func (m *MockTunnel) GetContainerUniqueKey(podKey string, container *corev1.Container) string

func (*MockTunnel) Key added in v0.2.0

func (m *MockTunnel) Key() string

func (*MockTunnel) OnNodeNotReady added in v0.3.0

func (m *MockTunnel) OnNodeNotReady(ctx context.Context, info model.UnreachableNodeInfo)

func (*MockTunnel) OnNodeStart added in v0.2.0

func (m *MockTunnel) OnNodeStart(ctx context.Context, nodeID string, initData model.NodeInfo)

func (*MockTunnel) OnNodeStop added in v0.2.0

func (m *MockTunnel) OnNodeStop(ctx context.Context, nodeID string)

func (*MockTunnel) PutContainer added in v0.2.0

func (m *MockTunnel) PutContainer(ctx context.Context, nodeID, containerKey string, data model.ContainerStatusData)

func (*MockTunnel) PutNode added in v0.2.0

func (m *MockTunnel) PutNode(ctx context.Context, nodeID string, node Node)

func (*MockTunnel) QueryAllContainerStatusData added in v0.2.0

func (m *MockTunnel) QueryAllContainerStatusData(ctx context.Context, nodeID string) error

func (*MockTunnel) Ready added in v0.2.0

func (m *MockTunnel) Ready() bool

func (*MockTunnel) RegisterCallback added in v0.2.0

func (m *MockTunnel) RegisterCallback(
	discovered OnNodeDiscovered,
	onNodeStatusDataArrived OnNodeStatusDataArrived,
	onQueryAllContainerStatusDataArrived OnQueryAllContainerStatusDataArrived,
	onSingleContainerStatusChanged OnSingleContainerStatusChanged)

func (*MockTunnel) ShutdownContainer added in v0.2.0

func (m *MockTunnel) ShutdownContainer(ctx context.Context, nodeID, podKey string, container *corev1.Container) error

func (*MockTunnel) Start added in v0.2.0

func (m *MockTunnel) Start(ctx context.Context, clientID string, env string) error

func (*MockTunnel) StartContainer added in v0.2.0

func (m *MockTunnel) StartContainer(ctx context.Context, nodeID, podKey string, container *corev1.Container) error

type Node added in v0.2.0

type Node struct {
	model.NodeInfo
	model.NodeStatusData
}

type OnNodeDiscovered added in v0.2.0

type OnNodeDiscovered func(string, model.NodeInfo, Tunnel)

OnNodeDiscovered is the node discover callback, will start/stop a vnode depends on node state

type OnNodeStatusDataArrived added in v0.2.0

type OnNodeStatusDataArrived func(string, model.NodeStatusData)

OnNodeStatusDataArrived is the node health data callback, will update vnode status to k8s

type OnQueryAllContainerStatusDataArrived added in v0.2.0

type OnQueryAllContainerStatusDataArrived func(string, []model.ContainerStatusData)

OnQueryAllContainerStatusDataArrived is the container status data callback, will update vpod status to k8s

type OnSingleContainerStatusChanged added in v0.2.0

type OnSingleContainerStatusChanged func(string, model.ContainerStatusData)

OnSingleContainerStatusChanged is one container status data callback, will update container-vpod status to k8s

type Tunnel

type Tunnel interface {
	// Key is the identity of Tunnel, will set to node label for special usage
	Key() string

	// Start is the func of tunnel start, please call the callback functions after start
	Start(ctx context.Context, clientID string, env string) error

	// Ready is the func for check tunnel ready, should return true after tunnel start success
	Ready() bool

	// RegisterCallback is the init func of Tunnel, please complete callback register in this func
	RegisterCallback(OnNodeDiscovered, OnNodeStatusDataArrived, OnQueryAllContainerStatusDataArrived, OnSingleContainerStatusChanged)

	// OnNodeStart is the func call when a vnode start successfully, you can implement it on demand
	OnNodeStart(ctx context.Context, nodeID string, initData model.NodeInfo)

	// OnNodeStop is the func call when a vnode shutdown successfully, you can implement it on demand
	OnNodeStop(ctx context.Context, nodeID string)

	// OnNodeNotReady is the func call when a vnode status turns to not ready, you can implement it on demand
	OnNodeNotReady(ctx context.Context, info model.UnreachableNodeInfo)

	// FetchHealthData is the func call for vnode to fetch health data , you need to fetch health data and call OnNodeStatusDataArrived when data arrived
	FetchHealthData(ctx context.Context, nodeID string) error

	// QueryAllContainerStatusData is the func call for vnode to fetch all containers status data , you need to fetch all containers status data and call OnQueryAllContainerStatusDataArrived when data arrived
	QueryAllContainerStatusData(ctx context.Context, nodeID string) error

	// StartContainer is the func calls for vnode to start a container , you need to start container and call OnStartContainerResponseArrived when start complete with a response
	StartContainer(ctx context.Context, nodeID, podKey string, container *v1.Container) error

	// ShutdownContainer is the func calls for vnode to shut down a container , you need to start to shut down container and call OnShutdownContainerResponseArrived when shut down process complete with a response
	ShutdownContainer(ctx context.Context, nodeID, podKey string, container *v1.Container) error

	// GetContainerUniqueKey is the func returns a unique key of a container in a pod, vnode will use this unique key to find target Container status
	GetContainerUniqueKey(podKey string, container *v1.Container) string
}

Jump to

Keyboard shortcuts

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