konnect

package
v2.11.1 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MinRefreshNodePeriod     = 30 * time.Second
	DefaultRefreshNodePeriod = 60 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GatewayClientGetter

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

GatewayClientGetter gets gateway instances from admin API clients.

func NewGatewayClientGetter

func NewGatewayClientGetter(logger logr.Logger, clientsProvider clients.AdminAPIClientsProvider) *GatewayClientGetter

NewGatewayClientGetter creates a GatewayClientGetter to get gateway instances from client provider.

func (*GatewayClientGetter) GetGatewayInstances

func (p *GatewayClientGetter) GetGatewayInstances(ctx context.Context) ([]GatewayInstance, error)

GetGatewayInstances gets gateway instances from currently available gateway API clients.

type GatewayClientsChangesNotifier

type GatewayClientsChangesNotifier interface {
	SubscribeToGatewayClientsChanges() (<-chan struct{}, bool)
}

type GatewayInstance

type GatewayInstance struct {
	Hostname string
	Version  string
	NodeID   string
}

GatewayInstance is a controlled kong gateway instance. its hostname and version will be used to update status of nodes corresponding to the instance in konnect.

type GatewayInstanceGetter

type GatewayInstanceGetter interface {
	GetGatewayInstances(ctx context.Context) ([]GatewayInstance, error)
}

GatewayInstanceGetter is the interface to get currently running gateway instances in the kubernetes cluster.

type ManagerInstanceIDProvider added in v2.10.0

type ManagerInstanceIDProvider interface {
	GetID() uuid.UUID
}

type NodeAgent

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

NodeAgent gets the running status of KIC node and controlled kong gateway nodes, and update their statuses to konnect.

func NewNodeAgent

func NewNodeAgent(
	hostname string,
	version string,
	refreshPeriod time.Duration,
	logger logr.Logger,
	client NodeClient,
	configStatusSubscriber clients.ConfigStatusSubscriber,
	gatewayGetter GatewayInstanceGetter,
	gatewayClientsChangesNotifier GatewayClientsChangesNotifier,
	managerInstanceIDProvider ManagerInstanceIDProvider,
	opts ...NodeAgentOpt,
) *NodeAgent

NewNodeAgent creates a new node agent. hostname and version are hostname and version of KIC.

func (*NodeAgent) NeedLeaderElection

func (a *NodeAgent) NeedLeaderElection() bool

NeedLeaderElection implements LeaderElectionRunnable interface to ensure that the node agent is run only when the KIC instance is elected a leader.

func (*NodeAgent) Start

func (a *NodeAgent) Start(ctx context.Context) error

Start runs the process of maintaining and uploading of KIC and kong gateway nodes.

type NodeAgentOpt added in v2.10.3

type NodeAgentOpt func(*NodeAgent)

func WithRefreshTicker added in v2.10.3

func WithRefreshTicker(ticker Ticker) NodeAgentOpt

WithRefreshTicker sets the refresh ticker of node agent.

type NodeClient added in v2.10.0

type NodeClient interface {
	CreateNode(ctx context.Context, req *nodes.CreateNodeRequest) (*nodes.CreateNodeResponse, error)
	UpdateNode(ctx context.Context, nodeID string, req *nodes.UpdateNodeRequest) (*nodes.UpdateNodeResponse, error)
	DeleteNode(ctx context.Context, nodeID string) error
	ListAllNodes(ctx context.Context) ([]*nodes.NodeItem, error)
}

NodeClient is the interface to Konnect Runtime Group Node API.

type Ticker added in v2.10.3

type Ticker interface {
	Stop()
	Channel() <-chan time.Time
	Reset(time.Duration)
}

Directories

Path Synopsis
Package runtimegroups provides primitives to interact with the openapi HTTP API.
Package runtimegroups provides primitives to interact with the openapi HTTP API.
Package runtimegroupsconfig provides primitives to interact with the openapi HTTP API.
Package runtimegroupsconfig provides primitives to interact with the openapi HTTP API.

Jump to

Keyboard shortcuts

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