manager

package
v2.9.4 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2023 License: Apache-2.0 Imports: 60 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 Run

func Run(ctx context.Context, c *Config, diagnostic util.ConfigDumpDiagnostic, deprecatedLogger logrus.FieldLogger) error

Run starts the controller manager and blocks until it exits.

func SetupLoggers added in v2.5.1

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

SetupLoggers sets up the loggers for the controller manager.

func ShouldEnableCRDController added in v2.8.0

func ShouldEnableCRDController(gvr schema.GroupVersionResource, restMapper meta.RESTMapper) bool

Types

type Config

type Config struct {

	// Logging configurations
	LogLevel            string
	LogFormat           string
	LogReduceRedundancy bool

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

	// Kong Proxy configurations
	APIServerHost         string
	APIServerQPS          int
	APIServerBurst        int
	MetricsAddr           string
	ProbeAddr             string
	KongAdminURLs         []string
	KongAdminSvc          OptionalNamespacedName
	KondAdminSvcPortNames []string
	ProxySyncSeconds      float32
	ProxyTimeoutSeconds   float32

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

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

	// Kubernetes API toggling
	IngressExtV1beta1Enabled      bool
	IngressNetV1beta1Enabled      bool
	IngressNetV1Enabled           bool
	IngressClassNetV1Enabled      bool
	IngressClassParametersEnabled bool
	UDPIngressEnabled             bool
	TCPIngressEnabled             bool
	KongIngressEnabled            bool
	KnativeIngressEnabled         bool
	KongClusterPluginEnabled      bool
	KongPluginEnabled             bool
	KongConsumerEnabled           bool
	ServiceEnabled                bool

	// Admission Webhook server config
	AdmissionServer admission.ServerConfig

	// Diagnostics and performance
	EnableProfiling     bool
	EnableConfigDumps   bool
	DumpSensitiveConfig bool

	// 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
	// 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 commandline flags.

func (*Config) GetKubeClient

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

func (*Config) GetKubeconfig

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

func (*Config) Validate added in v2.9.0

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.

func (*Config) ValidateGatewayDiscovery added in v2.9.0

func (c *Config) ValidateGatewayDiscovery(dbMode string) error

ValidateGatewayDiscovery returns error if dbMode is not configured to db-less mode. gateway discovery is only supported in db-less mode in its initial release: https://github.com/Kong/kubernetes-ingress-controller/issues/3401

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 IngressAPI

type IngressAPI int
const (
	OtherAPI IngressAPI = iota
	NetworkingV1
	NetworkingV1beta1
	ExtensionsV1beta1
)

type IngressControllerConditions added in v2.8.0

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

IngressControllerConditions negotiates the best Ingress API version supported by both KIC and the k8s apiserver and provides functions to determine if particular controllers should be enabled. TODO: https://github.com/Kong/kubernetes-ingress-controller/issues/1666

func NewIngressControllersConditions added in v2.8.0

func NewIngressControllersConditions(cfg *Config, mapper meta.RESTMapper) (*IngressControllerConditions, error)

func (*IngressControllerConditions) IngressClassNetV1Enabled added in v2.8.0

func (s *IngressControllerConditions) IngressClassNetV1Enabled() bool

IngressClassNetV1Enabled returns true if the chosen ingress class API version is networking.k8s.io/v1 and it's enabled.

func (*IngressControllerConditions) IngressExtV1beta1Enabled added in v2.8.0

func (s *IngressControllerConditions) IngressExtV1beta1Enabled() bool

IngressExtV1beta1Enabled returns true if the chosen ingress API version is extensions/v1beta1 and it's enabled.

func (*IngressControllerConditions) IngressNetV1Enabled added in v2.8.0

func (s *IngressControllerConditions) IngressNetV1Enabled() bool

IngressNetV1Enabled returns true if the chosen ingress API version is networking.k8s.io/v1 and it's enabled.

func (*IngressControllerConditions) IngressNetV1beta1Enabled added in v2.8.0

func (s *IngressControllerConditions) IngressNetV1beta1Enabled() bool

IngressNetV1beta1Enabled returns true if the chosen ingress API version is networking.k8s.io/v1beta1 and it's enabled.

type IsReady added in v2.9.0

type IsReady interface {
	IsReady() bool
}

type NoAvailableEndpointsError added in v2.9.0

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

func (NoAvailableEndpointsError) Error added in v2.9.0

type OptionalNamespacedName added in v2.9.0

type OptionalNamespacedName = mo.Option[types.NamespacedName]

type ValidatedValue added in v2.9.0

type ValidatedValue[T any] struct {
	// contains filtered or unexported fields
}

ValidatedValue implements `pflag.Value` interface. It can be used for hooking up arbitrary validation logic to any type. It should be passed to `pflag.FlagSet.Var()`.

func NewValidatedValue added in v2.9.0

func NewValidatedValue[T any](variable *T, constructor func(flagValue string) (T, error), opts ...ValidatedValueOpt[T]) ValidatedValue[T]

NewValidatedValue creates a validated variable of type T. Constructor should validate the input and return an error in case of any failures. If validation passes, constructor should return a value that's to be set in the variable. The constructor accepts a flagValue that is raw input from user's command line (or an env variable that was bind to the flag, see: bindEnvVars). It accepts a variadic list of options that can be used e.g. to set the default value or override the type name.

func (ValidatedValue[T]) Set added in v2.9.0

func (v ValidatedValue[T]) Set(s string) error

func (ValidatedValue[T]) String added in v2.9.0

func (v ValidatedValue[T]) String() string

func (ValidatedValue[T]) Type added in v2.9.0

func (v ValidatedValue[T]) Type() string

type ValidatedValueOpt added in v2.9.0

type ValidatedValueOpt[T any] func(*ValidatedValue[T])

func WithDefault added in v2.9.0

func WithDefault[T any](defaultValue T) ValidatedValueOpt[T]

WithDefault sets the default value for the validated variable.

func WithTypeNameOverride added in v2.9.0

func WithTypeNameOverride[T any](typeName string) ValidatedValueOpt[T]

WithTypeNameOverride overrides the type name that's printed in the help message.

Directories

Path Synopsis
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