indexers

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: Apache-2.0 Imports: 13 Imported by: 18

Documentation

Index

Constants

View Source
const (
	// APIExportByIdentity is the indexer name for retrieving APIExports by identity hash.
	APIExportByIdentity = "APIExportByIdentity"
	// APIExportBySecret is the indexer name for retrieving APIExports by secret.
	APIExportBySecret = "APIExportSecret"
	// APIExportByClaimedIdentities is the indexer name for retrieving APIExports that have a permission claim for a
	// particular identity hash.
	APIExportByClaimedIdentities = "APIExportByClaimedIdentities"
	// APIExportEndpointSliceByAPIExport is the indexer name for retrieving APIExportEndpointSlices by their APIExport's Reference Path and Name.
	APIExportEndpointSliceByAPIExport = "APIExportEndpointSliceByAPIExport"

	APIExportByVirtualResourceIdentities       = "APIExportByVirtualResourceIdentities"
	APIExportByVirtualResourceIdentitiesAndGRs = "APIExportByVirtualResourceIdentitiesAndGRs"

	// APIExportByAPIResourceSchema is the indexer name for retrieving APIExports by the
	// cluster-aware key of one of their APIResourceSchemas (Spec.Resources[].Schema).
	APIExportByAPIResourceSchema = "apiExportsByAPIResourceSchema"
)
View Source
const (
	// APIBindingByClusterAndAcceptedClaimedGroupResources is the name for the index that indexes an APIBinding by its
	// cluster name and accepted claimed group resources.
	APIBindingByClusterAndAcceptedClaimedGroupResources = "byClusterAndAcceptedClaimedGroupResources"
	// ByLogicalClusterPath indexes by logical cluster path, if the annotation exists.
	ByLogicalClusterPath = "ByLogicalClusterPath"
	// ByLogicalClusterPathAndName indexes by logical cluster path and object name, if the annotation exists.
	ByLogicalClusterPathAndName = "ByLogicalClusterPathAndName"
)
View Source
const APIBindingByAcceptedClaimIdentityAndGR = "apibinding-byAcceptedClaimIdentityAndGR"

APIBindingByAcceptedClaimIdentityAndGR is the indexer name for retrieving APIBindings by the (identityHash, group, resource) of any of their accepted permission claims that reference an external APIExport (i.e. claims with a non-empty IdentityHash).

View Source
const APIBindingByAcceptedClaimedGroupResource = "byAcceptedClaimedGroupResource"

APIBindingByAcceptedClaimedGroupResource is the indexer name for retrieving APIBindings by the (group, resource) of any of their accepted permission claims, regardless of cluster.

View Source
const APIBindingByBoundResourceUID = "byBoundResourceUID"
View Source
const APIBindingByBoundResources = "byBoundResources"
View Source
const (
	APIBindingByIdentityAndGroupResource = "apibinding-byIdentityGroupResource"
)
View Source
const APIBindingsByAPIExport = "APIBindingByAPIExport"

Variables

This section is empty.

Functions

func APIBindingBoundResourceValue added in v0.9.0

func APIBindingBoundResourceValue(clusterName logicalcluster.Name, group, resource string) string

func AddIfNotPresentOrDie added in v0.7.6

func AddIfNotPresentOrDie(indexer cache.Indexer, toAdd cache.Indexers)

AddIfNotPresentOrDie tries to add everything from toAdd to indexer's indexers that does not already exist. It panics if it encounters an error.

func Append added in v0.7.0

func Append(indexers ...cache.Indexers) (cache.Indexers, error)

Append is a helper function that merged a set of indexers.

func AppendOrDie added in v0.7.0

func AppendOrDie(indexers ...cache.Indexers) cache.Indexers

func ByIndex added in v0.8.0

func ByIndex[T runtime.Object](indexer cache.Indexer, indexName, indexValue string) ([]T, error)

ByIndex returns all instances of T that match indexValue in indexName in indexer.

func ByIndexWithFallback added in v0.20.0

func ByIndexWithFallback[T runtime.Object](indexer, globalIndexer cache.Indexer, indexName, indexValue string) ([]T, error)

ByIndexWithFallback returns all instances of T that match indexValue in indexer, if any. If none match, the same query is done of globalIndexer. Any errors short-circuit this logic.

func ByPathAndName added in v0.11.0

func ByPathAndName[T runtime.Object](groupResource schema.GroupResource, indexer cache.Indexer, path logicalcluster.Path, name string) (ret T, err error)

ByPathAndName returns the instance of T from the indexer with the matching path and name. Path may be a canonical path or a cluster name. Note: this depends on the presence of the optional "kcp.io/path" annotation.

func ByPathAndNameWithFallback added in v0.20.0

func ByPathAndNameWithFallback[T runtime.Object](groupResource schema.GroupResource, indexer, globalIndexer cache.Indexer, path logicalcluster.Path, name string) (ret T, err error)

ByPathAndNameWithFallback returns the instance of T from the indexer with the matching path and name. Path may be a canonical path or a cluster name. Note: this depends on the presence of the optional "kcp.io/path" annotation. If no instance is found, globalIndexer is searched as well. Any errors short-circuit this logic.

func ClusterAndGroupResourceValue added in v0.8.0

func ClusterAndGroupResourceValue(clusterName logicalcluster.Name, groupResource schema.GroupResource) string

ClusterAndGroupResourceValue returns the index value for use with IndexAPIBindingByClusterAndAcceptedClaimedGroupResources from clusterName and groupResource.

func IdentityGroupResourceKeyFunc added in v0.29.0

func IdentityGroupResourceKeyFunc(identity, group, resource string) string

func IndexAPIBindingByAPIExport added in v0.10.0

func IndexAPIBindingByAPIExport(obj interface{}) ([]string, error)

IndexAPIBindingByAPIExport indexes the APIBindings by their APIExport's Reference Path and Name.

func IndexAPIBindingByAcceptedClaimIdentityAndGR added in v0.32.0

func IndexAPIBindingByAcceptedClaimIdentityAndGR(obj interface{}) ([]string, error)

IndexAPIBindingByAcceptedClaimIdentityAndGR is an index function that indexes an APIBinding by every accepted permission claim that targets a resource from an external APIExport. The index key is "<identityHash>/<group>/<resource>".

CRDCleanup uses this to ask: "which APIBindings still need a particular bound CRD via a permission claim?" The CRD's group+resource come from its spec; the producer's identity hash comes from the APIExport that owns the schema annotated on the CRD.

func IndexAPIBindingByAcceptedClaimedGroupResource added in v0.32.0

func IndexAPIBindingByAcceptedClaimedGroupResource(obj interface{}) ([]string, error)

IndexAPIBindingByAcceptedClaimedGroupResource is an index function that indexes an APIBinding by every accepted permission claim's group/resource, with no cluster prefix. Used to find every binding on a shard that claims a given GVR (e.g. when a CRD's informer is added or removed shard-wide).

func IndexAPIBindingByBoundResourceUID added in v0.10.0

func IndexAPIBindingByBoundResourceUID(obj interface{}) ([]string, error)

func IndexAPIBindingByBoundResources added in v0.9.0

func IndexAPIBindingByBoundResources(obj interface{}) ([]string, error)

func IndexAPIBindingByClusterAndAcceptedClaimedGroupResources added in v0.8.0

func IndexAPIBindingByClusterAndAcceptedClaimedGroupResources(obj interface{}) ([]string, error)

IndexAPIBindingByClusterAndAcceptedClaimedGroupResources is an index function that indexes an APIBinding by its accepted permission claims' group resources.

func IndexAPIBindingByIdentityGroupResource added in v0.29.0

func IndexAPIBindingByIdentityGroupResource(obj interface{}) ([]string, error)

IndexAPIBindingByIdentityGroupResource is an index function that indexes an APIBinding by its bound resources' identity and group resource.

func IndexAPIExportByAPIResourceSchema added in v0.32.0

func IndexAPIExportByAPIResourceSchema(obj interface{}) ([]string, error)

IndexAPIExportByAPIResourceSchema is an index function that maps an APIExport to the cluster-aware keys of every APIResourceSchema it references in Spec.Resources. The key format is "<schemaCluster>|<schemaName>", matching client.ToClusterAwareKey output.

func IndexAPIExportByClaimedIdentities added in v0.11.0

func IndexAPIExportByClaimedIdentities(obj interface{}) ([]string, error)

IndexAPIExportByClaimedIdentities is an index function that indexes an APIExport by its permission claims' identity hashes.

func IndexAPIExportByIdentity

func IndexAPIExportByIdentity(obj interface{}) ([]string, error)

IndexAPIExportByIdentity is an index function that indexes an APIExport by its identity hash.

func IndexAPIExportBySecret added in v0.7.6

func IndexAPIExportBySecret(obj interface{}) ([]string, error)

IndexAPIExportBySecret is an index function that indexes an APIExport by its identity secret references. Index values are of the form <cluster name>|<secret reference namespace>/<secret reference name> (cache keys).

func IndexAPIExportByVirtualResourceIdentities added in v0.29.0

func IndexAPIExportByVirtualResourceIdentities(obj interface{}) ([]string, error)

IndexAPIExportByVirtualResourceIdentities is an index function that indexes an APIExport by its exported resources' virtual storage identity.

func IndexAPIExportByVirtualResourceIdentitiesAndGRs added in v0.29.0

func IndexAPIExportByVirtualResourceIdentitiesAndGRs(obj interface{}) ([]string, error)

IndexAPIExportByVirtualResourceIdentities is an index function that indexes an APIExport by its exported resources' virtual storage identity and group resource.

func IndexAPIExportEndpointSliceByAPIExport added in v0.27.0

func IndexAPIExportEndpointSliceByAPIExport(obj interface{}) ([]string, error)

IndexAPIExportEndpointSliceByAPIExportFunc indexes the APIExportEndpointSlice by their APIExport's Reference Path and Name.

func IndexByLogicalClusterPath added in v0.11.0

func IndexByLogicalClusterPath(obj interface{}) ([]string, error)

IndexByLogicalClusterPath indexes by logical cluster path, if the annotation exists.

func IndexByLogicalClusterPathAndName added in v0.11.0

func IndexByLogicalClusterPathAndName(obj interface{}) ([]string, error)

IndexByLogicalClusterPathAndName indexes by logical cluster path and object name, if the annotation exists.

func ListAPIBindingsByAcceptedClaimedGroupResource added in v0.32.0

func ListAPIBindingsByAcceptedClaimedGroupResource(indexer cache.Indexer, gr schema.GroupResource) ([]*apisv1alpha2.APIBinding, error)

ListAPIBindingsByAcceptedClaimedGroupResource returns every APIBinding on the shard that has an accepted permission claim for the given group/resource. The indexer must have APIBindingByAcceptedClaimedGroupResource registered.

func VirtualResourceIdentityAndGRKey added in v0.29.0

func VirtualResourceIdentityAndGRKey(identityHash string, gr schema.GroupResource) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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