clients

package
v2.10.5 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: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminAPIClientsManager

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

AdminAPIClientsManager keeps track of current Admin API clients of Gateways that we should configure. In particular, it can be notified about the clients' list update with use of Notify method, and queried for the latest slice of those with use of Clients method.

func NewAdminAPIClientsManager

func NewAdminAPIClientsManager(
	ctx context.Context,
	logger logrus.FieldLogger,
	initialClients []*adminapi.Client,
	kongClientFactory ClientFactory,
) (*AdminAPIClientsManager, error)

func (*AdminAPIClientsManager) GatewayClients

func (c *AdminAPIClientsManager) GatewayClients() []*adminapi.Client

GatewayClients returns a copy of current client's slice. Konnect client won't be included. This method can be used when some actions need to be performed only against Kong Gateway clients.

func (*AdminAPIClientsManager) GatewayClientsCount

func (c *AdminAPIClientsManager) GatewayClientsCount() int

func (*AdminAPIClientsManager) KonnectClient

func (c *AdminAPIClientsManager) KonnectClient() *adminapi.KonnectClient

func (*AdminAPIClientsManager) Notify

func (c *AdminAPIClientsManager) Notify(discoveredAPIs []adminapi.DiscoveredAdminAPI)

Notify receives a list of addresses that KongClient should use from now on as a list of Kong Admin API endpoints.

func (*AdminAPIClientsManager) RunNotifyLoop

func (c *AdminAPIClientsManager) RunNotifyLoop()

RunNotifyLoop runs a goroutine that will dynamically ingest new addresses of Kong Admin API endpoints.

func (*AdminAPIClientsManager) Running

func (c *AdminAPIClientsManager) Running() chan struct{}

Running returns a channel that is closed when the manager's background tasks are already running.

func (*AdminAPIClientsManager) SetKonnectClient

func (c *AdminAPIClientsManager) SetKonnectClient(client *adminapi.KonnectClient)

SetKonnectClient sets a client that will be used to communicate with Konnect Runtime Group Admin API. If called multiple times, it will override the client.

func (*AdminAPIClientsManager) SubscribeToGatewayClientsChanges

func (c *AdminAPIClientsManager) SubscribeToGatewayClientsChanges() (<-chan struct{}, bool)

SubscribeToGatewayClientsChanges returns a channel that will receive a notification on every Gateway clients update. Can be used to receive a signal when immediate reaction to the changes is needed. After receiving the notification, GatewayClients call will return an already updated slice of clients. It will return `false` as a second result in case the notifications loop is not running (e.g. static clients setup is used and no updates are going to happen).

type AdminAPIClientsProvider

type AdminAPIClientsProvider interface {
	KonnectClient() *adminapi.KonnectClient
	GatewayClients() []*adminapi.Client
}

AdminAPIClientsProvider allows fetching the most recent list of Admin API clients of Gateways that we should configure.

type CalculateConfigStatusInput

type CalculateConfigStatusInput struct {
	// Any error occurred when syncing with Gateways.
	GatewaysFailed bool

	// Any error occurred when syncing with Konnect,
	KonnectFailed bool

	// Translation of some of Kubernetes objects failed.
	TranslationFailuresOccurred bool
}

CalculateConfigStatusInput aggregates the input to CalculateConfigStatus.

type ChannelConfigNotifier

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

func NewChannelConfigNotifier

func NewChannelConfigNotifier(logger logr.Logger) *ChannelConfigNotifier

func (*ChannelConfigNotifier) NotifyConfigStatus

func (n *ChannelConfigNotifier) NotifyConfigStatus(ctx context.Context, status ConfigStatus)

NotifyConfigStatus sends the status in a separate goroutine. If the notification is not received in 1s, it's dropped.

func (*ChannelConfigNotifier) SubscribeConfigStatus

func (n *ChannelConfigNotifier) SubscribeConfigStatus() chan ConfigStatus

type ClientFactory

type ClientFactory interface {
	CreateAdminAPIClient(ctx context.Context, address string) (*adminapi.Client, error)
}

type ConfigStatus

type ConfigStatus string

ConfigStatus is an enumerated type that represents the status of the configuration synchronisation. Look at CalculateConfigStatus for more details.

const (
	ConfigStatusOK                                         ConfigStatus = "OK"
	ConfigStatusTranslationErrorHappened                   ConfigStatus = "TranslationErrorHappened"
	ConfigStatusApplyFailed                                ConfigStatus = "ApplyFailed"
	ConfigStatusOKKonnectApplyFailed                       ConfigStatus = "OKKonnectApplyFailed"
	ConfigStatusTranslationErrorHappenedKonnectApplyFailed ConfigStatus = "TranslationErrorHappenedKonnectApplyFailed"
	ConfigStatusApplyFailedKonnectApplyFailed              ConfigStatus = "ApplyFailedKonnectApplyFailed"
	ConfigStatusUnknown                                    ConfigStatus = "Unknown"
)

func CalculateConfigStatus

func CalculateConfigStatus(i CalculateConfigStatusInput) ConfigStatus

CalculateConfigStatus calculates a clients.ConfigStatus that sums up the configuration synchronisation result as a single enumerated value.

type ConfigStatusNotifier

type ConfigStatusNotifier interface {
	NotifyConfigStatus(context.Context, ConfigStatus)
}

type ConfigStatusSubscriber

type ConfigStatusSubscriber interface {
	SubscribeConfigStatus() chan ConfigStatus
}

type NoOpConfigStatusNotifier

type NoOpConfigStatusNotifier struct{}

func (NoOpConfigStatusNotifier) NotifyConfigStatus

func (n NoOpConfigStatusNotifier) NotifyConfigStatus(_ context.Context, _ ConfigStatus)

Jump to

Keyboard shortcuts

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