kubeagent

package
v0.0.0-...-1ae172a Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TunnelConnectPath  = "/api/v1/cluster/agent/connect"
	TunnelResponsePath = "/api/v1/cluster/agent/response"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

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

func NewAgent

func NewAgent(config *AgentConfig) *Agent

func (*Agent) Handle

func (a *Agent) Handle(receiveBytes []byte)

Handle 从tunnel接收到消息后进行处理,处理完成后将结果发送回server端

func (*Agent) OnSuccess

func (a *Agent) OnSuccess()

OnSuccess agent在每个集群中独立运行,当重新连接tunnel后,server有可能更新到最新版本, agent从server下载当前版本匹配的yaml,并更新;

func (*Agent) Run

func (a *Agent) Run(stopCh <-chan struct{})

Run 运行agent,tunnel通过websocket监听服务端消息,从tunnel接收到消息后,开启一个协程处理

type AgentConfig

type AgentConfig struct {
	Token        string
	KubeConfig   *config.KubeConfig
	ServerHost   string
	ServerClient *httpclient.HttpClient
}

func NewAgentConfig

func NewAgentConfig(options *AgentOptions) (a *AgentConfig, err error)

type AgentOptions

type AgentOptions struct {
	KubeConfigFile string
	AgentToken     string
	ServerHost     string
}

type ConnectOnSuccess

type ConnectOnSuccess func()

type Tunnel

type Tunnel interface {
	Run(stopCh <-chan struct{})
	Receive() <-chan []byte
	Send(interface{})
}

func NewTunnel

func NewTunnel(token string, serverHost string, callback TunnelCallback) Tunnel

type TunnelCallback

type TunnelCallback interface {
	OnSuccess()
}

Jump to

Keyboard shortcuts

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