Documentation
¶
Index ¶
- Constants
- type ClientFactory
- type ConfigSynchronizer
- type ConfigSynchronizerParams
- type GatewayClientGetter
- type GatewayClientsChangesNotifier
- type GatewayInstance
- type GatewayInstanceGetter
- type ManagerInstanceIDProvider
- type NodeAgent
- type NodeAgentOpt
- type NodeClient
- type TargetContent
- type TargetKongState
- type Ticker
Constants ¶
const ( // MinConfigUploadPeriod is the minimum period between operations to upload Kong configuration to Konnect. MinConfigUploadPeriod = 10 * time.Second // DefaultConfigUploadPeriod is the default period between operations to upload Kong configuration to Konnect. DefaultConfigUploadPeriod = 30 * time.Second )
const ( MinRefreshNodePeriod = 30 * time.Second DefaultRefreshNodePeriod = 60 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientFactory ¶ added in v3.4.3
type ClientFactory interface {
NewKonnectClient(ctx context.Context) (*adminapi.KonnectClient, error)
}
type ConfigSynchronizer ¶ added in v3.3.0
type ConfigSynchronizer struct {
// contains filtered or unexported fields
}
ConfigSynchronizer runs a loop to upload the translated Kong configuration to Konnect periodically.
func NewConfigSynchronizer ¶ added in v3.3.0
func NewConfigSynchronizer(p ConfigSynchronizerParams) *ConfigSynchronizer
func (*ConfigSynchronizer) KonnectClientInitialized ¶ added in v3.4.3
func (s *ConfigSynchronizer) KonnectClientInitialized() bool
KonnectClientInitialized returns true if the Konnect client is initialized and ready to upload configuration.
func (*ConfigSynchronizer) NeedLeaderElection ¶ added in v3.4.3
func (s *ConfigSynchronizer) NeedLeaderElection() bool
NeedLeaderElection returns true to indicate that this runnable requires leader election. This is required to ensure that only one instance of the synchronizer is running at a time.
func (*ConfigSynchronizer) Start ¶ added in v3.3.0
func (s *ConfigSynchronizer) Start(ctx context.Context) error
Start starts the loop to receive configuration and upload configuration to Konnect.
func (*ConfigSynchronizer) UpdateKongState ¶ added in v3.4.3
func (s *ConfigSynchronizer) UpdateKongState(ks *kongstate.KongState, isFallbackConfig bool)
UpdateKongState updates the Kong state to be uploaded to Konnect asynchronously. It may not update the state if the Konnect client is not initialized yet.
type ConfigSynchronizerParams ¶ added in v3.4.3
type ConfigSynchronizerParams struct {
Logger logr.Logger
KongConfig sendconfig.Config
ConfigUploadTicker Ticker
KonnectClientFactory ClientFactory
UpdateStrategyResolver sendconfig.UpdateStrategyResolver
ConfigChangeDetector sendconfig.ConfigurationChangeDetector
ConfigStatusNotifier clients.ConfigStatusNotifier
MetricsRecorder metrics.Recorder
}
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 ¶
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 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 ¶
NeedLeaderElection implements LeaderElectionRunnable interface to ensure that the node agent is run only when the KIC instance is elected a leader.
type NodeAgentOpt ¶
type NodeAgentOpt func(*NodeAgent)
func WithRefreshTicker ¶
func WithRefreshTicker(ticker Ticker) NodeAgentOpt
WithRefreshTicker sets the refresh ticker of node agent.
type NodeClient ¶
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 Control Plane Node API.
type TargetContent ¶ added in v3.4.3
type TargetContent struct {
*file.Content
// IsFallback indicates whether the configuration is a fallback configuration.
IsFallback bool
}
TargetContent wraps the deck content to be uploaded to Konnect and indicates whether the configuration is a fallback configuration.
type TargetKongState ¶ added in v3.4.3
type TargetKongState struct {
*kongstate.KongState
// IsFallback indicates whether the configuration is a fallback configuration.
IsFallback bool
}
TargetKongState wraps the Kong state to be uploaded to Konnect and indicates whether the configuration is a fallback configuration.