controlplane

package
v1.6.1-0...-dc2cabd Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2025 License: Apache-2.0 Imports: 61 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ControllerNameIngress identifies the controller for managing Kubernetes
	// Ingress resources using the networking/v1 API version.
	ControllerNameIngress = "INGRESS_NETWORKINGV1"
	// ControllerNameIngressClass identifies the controller for managing
	// Kubernetes IngressClass resources using the networking/v1 API version.
	ControllerNameIngressClass = "INGRESS_CLASS_NETWORKINGV1"
	// ControllerNameIngressClassParameters identifies the controller for
	// managing IngressClass parameters.
	ControllerNameIngressClassParameters = "INGRESS_CLASS_PARAMETERS"

	// ControllerNameKongClusterPlugin identifies the controller for managing
	// Kong cluster-scoped plugin resources.
	ControllerNameKongClusterPlugin = "KONG_CLUSTERPLUGIN"
	// ControllerNameKongPlugin identifies the controller for managing Kong
	// plugin resources.
	ControllerNameKongPlugin = "KONG_PLUGIN"
	// ControllerNameKongConsumer identifies the controller for managing Kong
	// consumer resources.
	ControllerNameKongConsumer = "KONG_CONSUMER"
	// ControllerNameKongUpstreamPolicy identifies the controller for managing
	// Kong upstream policy resources.
	ControllerNameKongUpstreamPolicy = "KONG_UPSTREAM_POLICY"
	// ControllerNameKongServiceFacade identifies the controller for managing
	// Kong service facade resources.
	ControllerNameKongServiceFacade = "KONG_SERVICE_FACADE"
	// ControllerNameKongVault identifies the controller for managing Kong vault
	// resources.
	ControllerNameKongVault = "KONG_VAULT"
	// ControllerNameKongLicense identifies the controller for managing Kong
	// license resources.
	ControllerNameKongLicense = "KONG_LICENSE"
	// ControllerNameKongCustomEntity identifies the controller for managing
	// Kong custom entity resources.
	ControllerNameKongCustomEntity = "KONG_CUSTOM_ENTITY"
	// ControllerNameService identifies the controller for managing Kubernetes
	// Service resources.
	ControllerNameService = "SERVICE"

	// ControllerNameGatewayAPIGateway identifies the controller for managing
	// Gateway API Gateway resources.
	ControllerNameGatewayAPIGateway = "GWAPI_GATEWAY"
	// ControllerNameGatewayAPIHTTPRoute identifies the controller for managing
	// Gateway API HTTPRoute resources.
	ControllerNameGatewayAPIHTTPRoute = "GWAPI_HTTPROUTE"
	// ControllerNameGatewayAPIGRPCRoute identifies the controller for managing
	// Gateway API GRPCRoute resources.
	ControllerNameGatewayAPIGRPCRoute = "GWAPI_GRPCROUTE"
	// ControllerNameGatewayAPIReferenceGrant identifies the controller for managing
	// Gateway API ReferenceGrant resources.
	ControllerNameGatewayAPIReferenceGrant = "GWAPI_REFERENCE_GRANT"
)

Variables

This section is empty.

Functions

func WithAnonymousReports

func WithAnonymousReports(enabled bool) managercfg.Opt

WithAnonymousReports sets whether anonymous usage reports are enabled for the manager.

func WithAnonymousReportsFixedPayloadCustomizer

func WithAnonymousReportsFixedPayloadCustomizer(customizer telemetryTypes.PayloadCustomizer) managercfg.Opt

WithAnonymousReportsFixedPayloadCustomizer sets a custom payload customizer for anonymous reports.

func WithCacheSyncPeriod

func WithCacheSyncPeriod(period time.Duration) managercfg.Opt

WithCacheSyncPeriod sets the cache sync period for the manager.

func WithClusterDomain

func WithClusterDomain(clusterDomain string) managercfg.Opt

WithClusterDomain sets the cluster domain for the manager.

func WithConfigDumpEnabled

func WithConfigDumpEnabled(enabled bool) managercfg.Opt

WithConfigDumpEnabled enables/disables dumping Kong configuration in ControlPlane.

func WithConfigMapLabelSelectorMatchLabel

func WithConfigMapLabelSelectorMatchLabel(key, value string) managercfg.Opt

WithConfigMapLabelSelectorMatchLabel sets the label selector to filter ingested config maps. It adds a filter that selects configmaps with label `key` with the value specified in `value`.

func WithControllers

func WithControllers(logger logr.Logger, controllers []gwtypes.ControlPlaneController) managercfg.Opt

WithControllers sets the controllers for the manager.

func WithDataPlaneSyncOptions

func WithDataPlaneSyncOptions(syncOptions gwtypes.ControlPlaneDataPlaneSync) managercfg.Opt

WithDataPlaneSyncOptions sets the option to sync Kong configuration with managed dataplanes.

func WithDisabledLeaderElection

func WithDisabledLeaderElection() managercfg.Opt

WithDisabledLeaderElection disables leader election for the manager.

func WithEmitKubernetesEvents

func WithEmitKubernetesEvents(emit bool) managercfg.Opt

WithEmitKubernetesEvents sets whether to emit Kubernetes events for the manager.

func WithFeatureGates

func WithFeatureGates(logger logr.Logger, featureGates []gwtypes.ControlPlaneFeatureGate) managercfg.Opt

WithFeatureGates sets the feature gates for the manager.

func WithGatewayAPIControllerName

func WithGatewayAPIControllerName() managercfg.Opt

WithGatewayAPIControllerName sets the Gateway API controller name for the manager.

func WithGatewayAPIControllersDisabled

func WithGatewayAPIControllersDisabled() managercfg.Opt

WithGatewayAPIControllersDisabled disables all Gateway API controllers.

func WithGatewayDiscoveryReadinessCheckInterval

func WithGatewayDiscoveryReadinessCheckInterval(interval *metav1.Duration) managercfg.Opt

WithGatewayDiscoveryReadinessCheckInterval sets the interval for checking the readiness of Gateway Discovery.

func WithGatewayDiscoveryReadinessCheckTimeout

func WithGatewayDiscoveryReadinessCheckTimeout(timeout *metav1.Duration) managercfg.Opt

WithGatewayDiscoveryReadinessCheckTimeout sets the timeout for checking the readiness of Gateway Discovery.

func WithGatewayToReconcile

func WithGatewayToReconcile(gateway types.NamespacedName) managercfg.Opt

WithGatewayToReconcile sets the gateway to reconcile for the manager.

func WithIngressClass

func WithIngressClass(ingressClass *string) managercfg.Opt

WithIngressClass sets the ingress class for the manager.

func WithInitCacheSyncDuration

func WithInitCacheSyncDuration(delay time.Duration) managercfg.Opt

WithInitCacheSyncDuration sets the initial delay to wait for Kubernetes object caches before syncing configuration with dataplanes.

func WithKongAdminAPIConfig

func WithKongAdminAPIConfig(cfg managercfg.AdminAPIClientConfig) managercfg.Opt

WithKongAdminAPIConfig sets the Kong Admin API configuration for the manager.

func WithKongAdminInitializationRetries

func WithKongAdminInitializationRetries(retries uint) managercfg.Opt

WithKongAdminInitializationRetries sets the Kong Admin initialization retries for the manager.

func WithKongAdminInitializationRetryDelay

func WithKongAdminInitializationRetryDelay(delay time.Duration) managercfg.Opt

WithKongAdminInitializationRetryDelay sets the Kong Admin initialization retry delay for the manager.

func WithKongAdminService

func WithKongAdminService(s types.NamespacedName) managercfg.Opt

WithKongAdminService sets the Kong Admin service for the manager.

func WithKongAdminServicePortName

func WithKongAdminServicePortName(portName string) managercfg.Opt

WithKongAdminServicePortName sets the Kong Admin service port name for the manager.

func WithKonnectOptions

func WithKonnectOptions(konnectOptions *operatorv2beta1.ControlPlaneKonnectOptions, existingKonnectConfig *managercfg.KonnectConfig) managercfg.Opt

WithKonnectOptions merges Konnect options from ControlPlane spec with the existing Konnect configuration. Note: c.Konnect is a value field (type managercfg.KonnectConfig), not a pointer, so it cannot be nil. When this option is applied via manager.NewConfig(...), the base config (including c.Konnect) has already been populated with defaults from CLI flag bindings. When used in isolation (e.g., unit tests that start from an empty managercfg.Config{}), the zero-value c.Konnect is still safe to modify and acts as the default baseline unless an existingKonnectConfig is provided.

func WithMetricsServerOff

func WithMetricsServerOff() managercfg.Opt

WithMetricsServerOff disables the metrics server for the manager.

func WithPublishService

func WithPublishService(service types.NamespacedName) managercfg.Opt

WithPublishService sets the publish service for the manager.

func WithQPSAndBurst

func WithQPSAndBurst(qps float32, burst int) managercfg.Opt

WithQPSAndBurst sets the QPS and burst for the API server.

func WithRestConfig

func WithRestConfig(restCfg *rest.Config, kubeConfigPath string) managercfg.Opt

WithRestConfig sets the REST configuration for the manager, but when a kubeConfigPath is provided, it defers to KIC logic to figure out the rest config.

func WithReverseSync

func WithReverseSync(state *gwtypes.ControlPlaneReverseSyncState) managercfg.Opt

WithReverseSync sets whether configuration is sent to Kong even if the configuration checksum has not changed since previous update.

func WithSecretLabelSelectorMatchLabel

func WithSecretLabelSelectorMatchLabel(key, value string) managercfg.Opt

WithSecretLabelSelectorMatchLabel sets the label selector to filter ingested secrets. It adds a filter that selects the secrets with label `key` with the value specified in `value`.

func WithSensitiveConfigDumpEnabled

func WithSensitiveConfigDumpEnabled(enabled bool) managercfg.Opt

WithSensitiveConfigDumpEnabled enables/disables including sensitive parts in dumped configuration.

func WithTranslationOptions

func WithTranslationOptions(opts *gwtypes.ControlPlaneTranslationOptions) managercfg.Opt

WithTranslationOptions sets the translation options for the manager.

func WithWatchNamespaces

func WithWatchNamespaces(watchNamespaces []string) managercfg.Opt

WithWatchNamespaces enables/disables watching namespaces for the manager.

Types

type CachedDiscoveryClient

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

CachedDiscoveryClient is a wrapper around the discovery client that caches the API resources for a period of time.

func NewDiscoveryClient

func NewDiscoveryClient(cfg *rest.Config, period time.Duration) *CachedDiscoveryClient

NewDiscoveryClient creates a new CachedDiscoveryClient.

func (*CachedDiscoveryClient) GetAPIResourceListMapping

func (c *CachedDiscoveryClient) GetAPIResourceListMapping() (map[schema.GroupVersion]*metav1.APIResourceList, error)

GetAPIResourceListMapping returns the GroupVersion to API resources map.

type ControlPlane

type ControlPlane = gwtypes.ControlPlane

ControlPlane is an alias for the internally used ControlPlane version type. This is to make it easier to refactor code. We can potentially get rid of this at some point when we change all references to the ControlPlane type to use the internal/types.ControlPlane type.

type ControlPlaneFinalizer

type ControlPlaneFinalizer string

ControlPlaneFinalizer defines finalizers added by controlplane controller.

const (
	// ControlPlaneFinalizerCleanupValidatingWebhookConfiguration is the finalizer to cleanup validatingwebhookconfigurations owned by controlplane on deleting.
	ControlPlaneFinalizerCleanupValidatingWebhookConfiguration ControlPlaneFinalizer = "gateway-operator.konghq.com/cleanup-validatingwebhookconfiguration"

	// ControlPlaneFinalizerCPInstanceTeardown is the finalizer to tear down a controlplane instance.
	ControlPlaneFinalizerCPInstanceTeardown ControlPlaneFinalizer = "gateway-operator.konghq.com/teardown-cp-instance"
)

type Reconciler

type Reconciler struct {
	client.Client
	CacheSyncPeriod          time.Duration
	CacheSyncTimeout         time.Duration
	ClusterCASecretName      string
	ClusterCASecretNamespace string
	ClusterCAKeyConfig       secrets.KeyConfig

	RestConfig              *rest.Config
	KubeConfigPath          string
	InstancesManager        *multiinstance.Manager
	KonnectEnabled          bool
	EnforceConfig           bool
	LoggingMode             logging.Mode
	AnonymousReportsEnabled bool
	ClusterDomain           string
	EmitKubernetesEvents    bool

	// SecretLabelSelector is the label selector configured at the operator level.
	// When not empty, it is used as the secret label selector of all ingress cotrollers' managers.
	SecretLabelSelector string
	// ConfigMapLabelSelector is the label selector configured at the oprator level.
	// When not empty, it is used as the config map label selector of all ingress cotrollers' managers.
	ConfigMapLabelSelector string

	// WatchNamespaces is a list of namespaces to watch. If empty (default), all namespaces are watched.
	WatchNamespaces []string
}

Reconciler reconciles a ControlPlane object

func (*Reconciler) Reconcile

func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile moves the current state of an object to the intended state.

func (*Reconciler) SetupWithManager

func (r *Reconciler) SetupWithManager(_ context.Context, mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

Jump to

Keyboard shortcuts

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