manager

package
v3.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 69 Imported by: 0

Documentation

Overview

Package manager implements the controller manager for all controllers

Index

Constants

View Source
const DiagnosticsPort = 10256

DiagnosticsPort is the default port of the manager's diagnostics service listens on.

View Source
const HealthzPort = 10254

HealthzPort is the default port the manager's health service listens on. Changing this will result in a breaking change. Existing deployments may use the literal port number in their liveness and readiness probes, and upgrading to a controller version with a changed HealthzPort will result in crash loops until users update their probe config. Note that there are several stock manifests in this repo that also use the literal port number. If you update this value, search for the old port number and update the stock manifests also.

View Source
const KongClientEventRecorderComponentName = "kong-client"

KongClientEventRecorderComponentName is a KongClient component name used to identify the events recording component.

View Source
const MetricsPort = 10255

MetricsPort is the default port the manager's metrics service listens on. Similar to HealthzPort, it may be used in existing user deployment configurations, and its literal value is used in several stock manifests, which must be updated along with this value.

Variables

This section is empty.

Functions

func AdminAPIClientFromServiceDiscovery

func AdminAPIClientFromServiceDiscovery(
	ctx context.Context,
	logger logr.Logger,
	kongAdminSvcNN k8stypes.NamespacedName,
	kubeClient client.Client,
	discoverer AdminAPIsDiscoverer,
	factory AdminAPIClientFactory,
	retryOpts ...retry.Option,
) ([]*adminapi.Client, error)

func Run

func Run(
	ctx context.Context,
	c *Config,
	diagnostic util.ConfigDumpDiagnostic,
	logger logr.Logger,
) error

Run starts the controller manager and blocks until it exits.

func SetupLoggers

func SetupLoggers(c *Config, output io.Writer) (logr.Logger, error)

SetupLoggers sets up the loggers for the controller manager.

Types

type AdminAPIClientFactory

type AdminAPIClientFactory interface {
	CreateAdminAPIClient(context.Context, adminapi.DiscoveredAdminAPI) (*adminapi.Client, error)
}

type AdminAPIsDiscoverer

type AdminAPIsDiscoverer interface {
	GetAdminAPIsForService(context.Context, client.Client, k8stypes.NamespacedName) (sets.Set[adminapi.DiscoveredAdminAPI], error)
}

type Config

type Config struct {

	// Logging configurations
	LogLevel  string
	LogFormat string

	// Kong high-level controller manager configurations
	KongAdminAPIConfig                adminapi.HTTPClientOpts
	KongAdminInitializationRetries    uint
	KongAdminInitializationRetryDelay time.Duration
	KongAdminToken                    string
	KongAdminTokenPath                string
	KongWorkspace                     string
	AnonymousReports                  bool
	EnableReverseSync                 bool
	SyncPeriod                        time.Duration
	SkipCACertificates                bool
	CacheSyncTimeout                  time.Duration
	GracefulShutdownTimeout           *time.Duration

	// Kong Proxy configurations
	APIServerHost               string
	APIServerQPS                int
	APIServerBurst              int
	APIServerCAData             []byte
	APIServerCertData           []byte
	APIServerKeyData            []byte
	MetricsAddr                 string
	ProbeAddr                   string
	KongAdminURLs               []string
	KongAdminSvc                OptionalNamespacedName
	GatewayDiscoveryDNSStrategy cfgtypes.DNSStrategy
	KongAdminSvcPortNames       []string
	ProxySyncSeconds            float32
	InitCacheSyncDuration       time.Duration
	ProxyTimeoutSeconds         float32

	// Kubernetes configurations
	KubeconfigPath           string
	IngressClassName         string
	LeaderElectionNamespace  string
	LeaderElectionID         string
	Concurrency              int
	FilterTags               []string
	WatchNamespaces          []string
	GatewayAPIControllerName string
	Impersonate              string
	EmitKubernetesEvents     bool

	// Ingress status
	PublishServiceUDP       OptionalNamespacedName
	PublishService          OptionalNamespacedName
	PublishStatusAddress    []string
	PublishStatusAddressUDP []string

	UpdateStatus                bool
	UpdateStatusQueueBufferSize int

	// Kubernetes API toggling
	IngressNetV1Enabled           bool
	IngressClassNetV1Enabled      bool
	IngressClassParametersEnabled bool
	UDPIngressEnabled             bool
	TCPIngressEnabled             bool
	KongIngressEnabled            bool
	KongClusterPluginEnabled      bool
	KongPluginEnabled             bool
	KongConsumerEnabled           bool
	ServiceEnabled                bool
	KongUpstreamPolicyEnabled     bool
	KongServiceFacadeEnabled      bool
	KongVaultEnabled              bool
	KongLicenseEnabled            bool

	// Gateway API toggling.
	GatewayAPIGatewayController        bool
	GatewayAPIHTTPRouteController      bool
	GatewayAPIReferenceGrantController bool

	// KIC can only reconciling the specified Gateway.
	GatewayToReconcile OptionalNamespacedName

	// Admission Webhook server config
	AdmissionServer admission.ServerConfig

	// Diagnostics and performance
	EnableProfiling      bool
	EnableConfigDumps    bool
	DumpSensitiveConfig  bool
	DiagnosticServerPort int

	// Feature Gates
	FeatureGates map[string]bool

	// TermDelay is the time.Duration which the controller manager will wait
	// after receiving SIGTERM or SIGINT before shutting down. This can be
	// helpful for advanced cases with load-balancers so that the ingress
	// controller can be gracefully removed/drained from their rotation.
	TermDelay time.Duration

	Konnect adminapi.KonnectConfig

	// Override default telemetry settings (e.g. for testing). They aren't exposed in the CLI.
	SplunkEndpoint                   string
	SplunkEndpointInsecureSkipVerify bool
	TelemetryPeriod                  time.Duration
	// contains filtered or unexported fields
}

Config collects all configuration that the controller manager takes from the environment.

func (*Config) FlagSet

func (c *Config) FlagSet() *pflag.FlagSet

FlagSet binds the provided Config to command-line flags.

func (*Config) GetKubeClient

func (c *Config) GetKubeClient() (client.Client, error)

func (*Config) GetKubeconfig

func (c *Config) GetKubeconfig() (*rest.Config, error)

func (*Config) Resolve

func (c *Config) Resolve() error

Resolve the Config item(s) value from file, when provided.

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the config. It should be used to validate the config variables' interdependencies. When a single variable is to be validated, *FromFlagValue function should be implemented.

type Controller

type Controller interface {
	SetupWithManager(ctrl.Manager) error
}

Controller is a Kubernetes controller that can be plugged into Manager.

type ControllerDef

type ControllerDef struct {
	Enabled    bool
	Controller Controller
}

ControllerDef is a specification of a Controller that can be conditionally registered with Manager.

func (*ControllerDef) MaybeSetupWithManager

func (c *ControllerDef) MaybeSetupWithManager(mgr ctrl.Manager) error

MaybeSetupWithManager runs SetupWithManager on the controller if it is enabled.

func (*ControllerDef) Name

func (c *ControllerDef) Name() string

Name returns a human-readable name of the controller.

type InstanceIDProvider

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

InstanceIDProvider provides a unique identifier for a running instance of the manager. It should be used by all components that register the instance in any external system.

func NewInstanceIDProvider

func NewInstanceIDProvider() *InstanceIDProvider

func (*InstanceIDProvider) GetID

func (p *InstanceIDProvider) GetID() uuid.UUID

type IsReady

type IsReady interface {
	IsReady() bool
}

type NoAvailableEndpointsError

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

func (NoAvailableEndpointsError) Error

type OptionalNamespacedName

type OptionalNamespacedName = mo.Option[k8stypes.NamespacedName]

type TypeMetaSettingClient

type TypeMetaSettingClient struct {
	client.Client
}

TypeMetaSettingClient decorates client.Client so that it populates the TypeMeta field of the object after fetching it from the API server.

func NewTypeMetaSettingClient

func NewTypeMetaSettingClient(c client.Client) TypeMetaSettingClient

func (TypeMetaSettingClient) Get

Get retrieves an object from the Kubernetes API server and populates the TypeMeta field of the object.

Directories

Path Synopsis
config
Package metadata includes metadata variables for logging and reporting.
Package metadata includes metadata variables for logging and reporting.
utils

Jump to

Keyboard shortcuts

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