base

package
v1.14.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeartbeatInterval = time.Second
	CheckInterval     = time.Second * 5
)
View Source
const (
	SessionIDHeaderKey = "X-Tunnel-Session-ID"
	BufferSize         = 4096
)
View Source
const (
	DefaultAgentNamespace    string = "kube-system"
	ConfigMapProviderName    string = "provider"
	ConfigMapProviderKey     string = "provider"
	ConfigMapProviderAutoKey string = "auto"
	ConfigMapAgentConfigName string = "ack-agent-config"
	ConfigMapScriptPathKey   string = "addNodeScriptPath"
)

Variables

This section is empty.

Functions

func Heartbeat

func Heartbeat(ctx context.Context, logger *logrus.Logger, conn net.Conn, cfg *rest.Config)

Heartbeat send heartbeat byte to stub requester each HeartbeatInterval in order to maintain connection. Otherwise, requester will decrease the health of this connection and in the end kick it off.

func StartHealthzServer

func StartHealthzServer(addr string, logger *logrus.Logger)

Types

type AgentMeta

type AgentMeta struct {
	Provider         string            `json:"provider"`
	K8sVersion       string            `json:"k8sversion"`
	IsIntranet       string            `json:"isintranet"`
	CustomizeCommand string            `json:"customizecommand"`
	Data             map[string]string `json:"data"`
}

Note: Any change to this struct needs to update DeepCopy function as well.

func (*AgentMeta) DeepCopy

func (src *AgentMeta) DeepCopy(dest *AgentMeta)

type Component

type Component struct {
	context.Context
	*logrus.Logger
	sync.Mutex
}

func NewComponent

func NewComponent(ctx context.Context, logger *logrus.Logger) Component

type Heart

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

func (*Heart) Beat

func (h *Heart) Beat()

func (*Heart) CheckCluster

func (h *Heart) CheckCluster()

type StubMeta

type StubMeta struct {
	State         TunnelState          `json:"state"`
	ActiveCluster string               `json:"active_cluster"`
	AgentsMeta    map[string]AgentMeta `json:"agents_meta"`
	Version       string               `json:"version"`
}

type StubMetaProviderFunc

type StubMetaProviderFunc func() StubMeta

type TunnelEndpoint

type TunnelEndpoint struct {
	Component
}

TunnelEndpoint is initially designed for common parts of stub and agent.

func NewTunnelEndpoint

func NewTunnelEndpoint(ctx context.Context, logger *logrus.Logger) TunnelEndpoint

func (*TunnelEndpoint) CheckAndStartPipe

func (endpoint *TunnelEndpoint) CheckAndStartPipe(request *http.Request, response *http.Response, endpointA io.ReadWriter, endpointB io.ReadWriter)

CheckAndStartPipe will check request header and response status code to see if there is a successful upgrade negotiation. The order of endpointA and endpointB only affect to log, A2B is forward and B2A is backward. X2Y means read from X and write to Y. This pipe is a full duplex pipe. The close of this pipe is caused by either context done or any error from any connection. The data is read in SPDY format where the auxiliary function `readSPDYFrame` does. Reference: https://www.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3-1 section 2.2.

type TunnelState

type TunnelState string

Jump to

Keyboard shortcuts

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