indexers

package
v1.20.2 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package indexers holds functions related to building indexes for Kubernetes objects in the client cache.

Index functions in this package MUST:

  • return a function with signature `func(rawObj client.Object) []string`, where the `[]string` contains a set of values to index that object by. Generally this should be full names (`namespace/name` of a particular related object type).

An example here is the generateIndexerHTTPRouteByBackendService function, which takes a client.Client and returns a closure that can index HTTPRoutes by the referenced backend service, because ServiceImport support also requires dereferencing a backend Service from annotations on the ServiceImport object.

Index functions in this package that are used in reconcilers MUST also:

  • only operate on a single object (no using a client to GET other objects, for example)

An example here is the indexHTTPRouteByGateway function, which is used in the Gateway reconciler to filter a HTTPRoute List operation so that it only lists HTTPRoutes that have the Gateway under reconciliation as a parent. In order to be able to use the indexer in the tests for the Gateway reconciler, it cannot use a client.Client, as the indexer functions are used to build the fake Client.

Index

Constants

View Source
const (
	// Indexes HTTPRoutes by all the backend Services referenced in the object.
	BackendServiceHTTPRouteIndex = "BackendServiceHTTPRouteIndex"

	// Indexes HTTPRoutes by all the backend ServiceImports referenced in the object.
	BackendServiceImportHTTPRouteIndex = "BackendServiceImportHTTPRouteIndex"

	// Indexes HTTPRoutes by all the Gateway parents referenced in the object.
	GatewayHTTPRouteIndex = "gatewayHTTPRouteIndex"

	// Indexes Gateways and records if the Gateway is relevant for Cilium.
	ImplementationGatewayIndex = "implementationGatewayIndex"

	// Indexes TLSRoutes by all the backend Services referenced in the object.
	BackendServiceTLSRouteIndex = "backendServiceTLSRouteIndex"

	// Indexes TLSRoutes by all the backend ServiceImports referenced in the object.
	BackendServiceImportTLSRouteIndex = "backendServiceImportTLSRouteIndex"

	// Indexes TLSRoutes by all the Gateway parents referenced in the object.
	GatewayTLSRouteIndex = "gatewayTLSRouteIndex"

	// Indexes GRPCRoutes by all the backend Services referenced in the object.
	BackendServiceGRPCRouteIndex = "backendServiceGRPCRouteIndex"

	// Indexes GRPCRoutes by all the backend ServiceImports referenced in the object.
	BackendServiceImportGRPCRouteIndex = "BackendServiceImportGRPCRouteIndex"

	// Indexes GRPCRoutes by all the Gateway parents referenced in the object.
	GatewayGRPCRouteIndex = "gatewayGRPCRouteIndex"

	// Indexes BackendTLSPolicies by all the ConfigMaps referenced in the object.
	BackendTLSPolicyConfigMapIndex = "backendTLSPolicyConfigMaps"

	// Indexes GAMMA HTTPRoutes by all the GAMMA parents of that HTTPRoute.
	// This is then be used by the Service reconciler to only retrieve any HTTPRoutes that have that specific
	// Service as a parent.
	GammaHTTPRouteParentRefsIndex = "gammaHTTPRouteParentRefs"

	// Indexes GAMMA GRPCRoutes by all the GAMMA parents of that GRPCRoute.
	// This is then be used by the Service reconciler to only retrieve any GRPCRoutes that have that specific
	// Service as a parent.
	GammaGRPCRouteParentRefsIndex = "gammaGRPCRouteParentRefs"

	// Indexes GatewayClass objects by the CiliumGatewayClassConfig they reference.
	GatewayClassCiliumGatewayClassConfigsIndex = "gatewayClassCiliumGatewayClassConfigsIndex"

	// Indexes TCPRoutes by all the backend Services referenced in the object.
	BackendServiceTCPRouteIndex = "backendServiceTCPRouteIndex"

	// Indexes TCPRoutes by all the backend ServiceImports referenced in the object.
	BackendServiceImportTCPRouteIndex = "backendServiceImportTCPRouteIndex"

	// Indexes TCPRoutes by all the Gateway parents referenced in the object.
	GatewayTCPRouteIndex = "gatewayTCPRouteIndex"

	// Indexes UDPRoutes by all the backend Services referenced in the object.
	BackendServiceUDPRouteIndex = "backendServiceUDPRouteIndex"

	// Indexes UDPRoutes by all the backend ServiceImports referenced in the object.
	BackendServiceImportUDPRouteIndex = "backendServiceImportUDPRouteIndex"

	// Indexes UDPRoutes by all the Gateway parents referenced in the object.
	GatewayUDPRouteIndex = "gatewayUDPRouteIndex"

	// Indexes ListenerSets by the parent Gateway referenced in the object.
	ListenerSetGatewayIndex = "listenerSetGatewayIndex"

	// Indexes HTTPRoutes by all the ListenerSet parents referenced in the object.
	HTTPRouteListenerSetIndex = "listenerSetHTTPRouteIndex"

	// Indexes GRPCRoutes by all the ListenerSet parents referenced in the object.
	GRPCRouteListenerSetIndex = "listenerSetGRPCRouteIndex"

	// Indexes TLSRoutes by all the ListenerSet parents referenced in the object.
	TLSRouteListenerSetIndex = "listenerSetTLSRouteIndex"

	// Indexes TCPRoutes by all the ListenerSet parents referenced in the object.
	TCPRouteListenerSetIndex = "listenerSetTCPRouteIndex"

	// Indexes UDPRoutes by all the ListenerSet parents referenced in the object.
	UDPRouteListenerSetIndex = "listenerSetUDPRouteIndex"
)

Variables

This section is empty.

Functions

func GenerateIndexerGRPCRoutebyBackendService

func GenerateIndexerGRPCRoutebyBackendService(c helpers.ClientReader, logger *slog.Logger) client.IndexerFunc

GenerateIndexerGRPCRoutebyBackendService takes a single GRPCRoute and returns all referenced backend service full names (`namespace/name`) to add to the relevant index.

func GenerateIndexerGatewayByImplementation

func GenerateIndexerGatewayByImplementation(c helpers.ClientReader, controllerName gatewayv1.GatewayController) client.IndexerFunc

indexGatewayByImplementation adds the controller name to indexers.ImplementationGatewayIndex if the Gateway has a GatewayClass with that controller name.

func GenerateIndexerHTTPRouteByBackendService

func GenerateIndexerHTTPRouteByBackendService(c helpers.ClientReader, logger *slog.Logger) client.IndexerFunc

GenerateIndexerHTTPRouteByBackendService makes a client.IndexerFunc that takes a single HTTPRoute and returns all referenced backend service full names (`namespace/name`) to add to the relevant index.

func GenerateIndexerTCPRoutebyBackendService added in v1.20.0

func GenerateIndexerTCPRoutebyBackendService(c helpers.ClientReader, logger *slog.Logger) client.IndexerFunc

GenerateIndexerTCPRoutebyBackendService takes a single TCPRoute and returns all referenced backend service full names (`namespace/name`) to add to the relevant index.

func GenerateIndexerTLSRoutebyBackendService

func GenerateIndexerTLSRoutebyBackendService(c helpers.ClientReader, logger *slog.Logger) client.IndexerFunc

indexTLSRoutebyBackendService takes a single TLSRoute and returns all referenced backend service full names (`namespace/name`) to add to the relevant index.

func GenerateIndexerUDPRoutebyBackendService added in v1.20.0

func GenerateIndexerUDPRoutebyBackendService(c helpers.ClientReader, logger *slog.Logger) client.IndexerFunc

GenerateIndexerUDPRoutebyBackendService takes a single UDPRoute and returns all referenced backend service full names (`namespace/name`) to add to the relevant index.

func IndexBTLSPolicyByConfigMap added in v1.20.0

func IndexBTLSPolicyByConfigMap(rawObj client.Object) []string

func IndexGRPCRouteByBackendServiceImport added in v1.20.0

func IndexGRPCRouteByBackendServiceImport(rawObj client.Object) []string

IndexGRPCRouteByBackendServiceImport is a client.IndexerFunc that takes a single GRPCRoute and returns all referenced backend ServiceImport full names (`namespace/name`) to add to the relevant index.

func IndexGRPCRouteByGammaService added in v1.19.0

func IndexGRPCRouteByGammaService(rawObj client.Object) []string

IndexGRPCRouteByGammaService is a client.IndexerFunc that takes a single GRPCRoute and returns all referenced Service object full names (`namespace/name`) to add to the relevant index.

func IndexGRPCRouteByGateway

func IndexGRPCRouteByGateway(rawObj client.Object) []string

IndexGRPCRouteByGateway is a client.IndexerFunc that takes a single GRPCRoute and returns all referenced Gateway object full names (`namespace/name`) to add to the relevant index.

Note that this does _not_ filter to only Cilium-relevant Gateways.

func IndexGRPCRouteByListenerSet added in v1.20.0

func IndexGRPCRouteByListenerSet(rawObj client.Object) []string

IndexGRPCRouteByListenerSet indexes GRPCRoutes by all ListenerSet parents referenced in the object, returning ListenerSet full names (`namespace/name`).

func IndexGatewayBySecret added in v1.20.0

func IndexGatewayBySecret(rawObj client.Object) []string

func IndexGatewayClassByCiliumGatewayClassConfig

func IndexGatewayClassByCiliumGatewayClassConfig(controllerName gatewayv1.GatewayController) client.IndexerFunc

IndexGatewayClassByCiliumGatewayClassConfig indexes GatewayClass objects by the referenced CiliumGatewayClassConfig for the given controller.

func IndexHTTPRouteByBackendServiceImport

func IndexHTTPRouteByBackendServiceImport(rawObj client.Object) []string

IndexHTTPRouteByBackendServiceImport is a client.IndexerFunx that takes a single HTTPRoute and returns all referenced backend ServiceImport full names (`namespace/name`) to add to the relevant index.

func IndexHTTPRouteByGammaService added in v1.19.0

func IndexHTTPRouteByGammaService(rawObj client.Object) []string

IndexHTTPRouteByGammaService is a client.IndexerFunc that takes a single HTTPRoute and returns all referenced Service object full names (`namespace/name`) to add to the relevant index.

func IndexHTTPRouteByGateway

func IndexHTTPRouteByGateway(rawObj client.Object) []string

IndexHTTPRouteByGateway is a client.IndexerFunc that takes a single HTTPRoute and returns all referenced Gateway object full names (`namespace/name`) to add to the relevant index.

Note that this does _not_ filter to only Cilium-relevant Gateways.

func IndexHTTPRouteByListenerSet added in v1.20.0

func IndexHTTPRouteByListenerSet(rawObj client.Object) []string

IndexHTTPRouteByListenerSet indexes HTTPRoutes by all ListenerSet parents referenced in the object, returning ListenerSet full names (`namespace/name`).

func IndexListenerSetByGateway added in v1.20.0

func IndexListenerSetByGateway(rawObj client.Object) []string

IndexListenerSetByGateway is a client.IndexerFunc that takes a single ListenerSet and returns the parent Gateway object full name (`namespace/name`) to add to the relevant index.

func IndexListenerSetBySecret added in v1.20.0

func IndexListenerSetBySecret(rawObj client.Object) []string

func IndexTCPRouteByBackendServiceImport added in v1.20.1

func IndexTCPRouteByBackendServiceImport(rawObj client.Object) []string

IndexTCPRouteByBackendServiceImport is a client.IndexerFunc that takes a single TCPRoute and returns all referenced backend ServiceImport full names (`namespace/name`) to add to the relevant index.

func IndexTCPRouteByGateway added in v1.20.0

func IndexTCPRouteByGateway(rawObj client.Object) []string

IndexTCPRouteByGateway takes a single TCPRoute and returns all referenced Gateway object full names (`namespace/name`) to add to the relevant index.

Note that this does _not_ filter to only Cilium-relevant Gateways.

func IndexTCPRouteByListenerSet added in v1.20.0

func IndexTCPRouteByListenerSet(rawObj client.Object) []string

func IndexTLSRouteByBackendServiceImport added in v1.20.1

func IndexTLSRouteByBackendServiceImport(rawObj client.Object) []string

IndexTLSRouteByBackendServiceImport is a client.IndexerFunc that takes a single TLSRoute and returns all referenced backend ServiceImport full names (`namespace/name`) to add to the relevant index.

func IndexTLSRouteByGateway

func IndexTLSRouteByGateway(rawObj client.Object) []string

IndexTLSRouteByGateway takes a single TLSRoute and returns all referenced Gateway object full names (`namespace/name`) to add to the relevant index.

Note that this does _not_ filter to only Cilium-relevant Gateways.

func IndexTLSRouteByListenerSet added in v1.20.0

func IndexTLSRouteByListenerSet(rawObj client.Object) []string

IndexTLSRouteByListenerSet indexes TLSRoutes by all ListenerSet parents referenced in the object, returning ListenerSet full names (`namespace/name`).

func IndexUDPRouteByBackendServiceImport added in v1.20.1

func IndexUDPRouteByBackendServiceImport(rawObj client.Object) []string

IndexUDPRouteByBackendServiceImport is a client.IndexerFunc that takes a single UDPRoute and returns all referenced backend ServiceImport full names (`namespace/name`) to add to the relevant index.

func IndexUDPRouteByGateway added in v1.20.0

func IndexUDPRouteByGateway(rawObj client.Object) []string

IndexUDPRouteByGateway takes a single UDPRoute and returns all referenced Gateway object full names (`namespace/name`) to add to the relevant index.

Note that this does _not_ filter to only Cilium-relevant Gateways.

func IndexUDPRouteByListenerSet added in v1.20.0

func IndexUDPRouteByListenerSet(rawObj client.Object) []string

Types

This section is empty.

Jump to

Keyboard shortcuts

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