provider

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConditionReadyFunc added in v0.7.0

func ConditionReadyFunc(conditionType string) func(client.Object) (bool, error)

ConditionReadyFunc returns a function that checks if the given object has a condition with the given type and status True.

func DefaultExtractURLsFromEndpointSlice added in v0.7.0

func DefaultExtractURLsFromEndpointSlice(obj client.Object) ([]string, error)

DefaultExtractURLsFromEndpointSlice extracts virtual workspace URLs from any object with a .status.endpoints[].url structure (e.g. APIExportEndpointSlice).

Types

type NewClusterFunc added in v0.4.0

type NewClusterFunc func(cfg *rest.Config, clusterName logicalcluster.Name, wildcardCA mcpcache.WildcardCache, scheme *runtime.Scheme, recorderProvider mcrecorder.EventRecorderGetter) (*mcpcache.ScopedCluster, error)

NewClusterFunc allows customizing the concrete cluster implementation used for every engaged cluster.

type Options

type Options struct {
	// Scheme is the scheme to use for the provider.
	// If this is nil it defaults to the client-go scheme.
	Scheme *runtime.Scheme

	// EndpointSliceObject is the object type for the endpoint slice,
	// that records virtual workspace URLs of different shards.
	// If this is nil it defaults to [apisv1alpha2.APIExportEndpointSlice].
	EndpointSliceObject client.Object

	// ExtractURLsFromEndpointSlice is used to extract the URLs from the EndpointSliceObject.
	// If this is nil it defaults to [DefaultExtractURLsFromEndpointSlice].
	ExtractURLsFromEndpointSlice func(obj client.Object) ([]string, error)

	// ObjectToWatch is the object type the provider watches inside of
	// the virtual workspaces to observe logical clusters joining and
	// leaving the virtual workspaces.
	// If this is nil it defaults to [apisv1alpha2.APIBinding].
	ObjectToWatch client.Object

	// Log is the logger used to write any logs.
	Log *logr.Logger

	// NewCluster allows to customize the cluster instance that is being created for
	// each engaged cluster. If this is not set, it defaults to a ScopedCache that
	// uses the wildcard endpoint for its cache.
	NewCluster NewClusterFunc

	// AddFilter is called to filter objects to engage.
	// If false is returned the object is not engaged.
	AddFilter func(obj client.Object) (bool, error)

	// UpdateFilter is called to filter objects to engage.
	// If false is returned the object is not engaged.
	UpdateFilter func(obj client.Object) (bool, error)

	// Handlers are lifecycle handlers for logical clusters managed by this provider represented
	// by apibinding object.
	Handlers handlers.Handlers
}

Options are the options for a provider.

type Provider

type Provider struct {

	// Clusters keeps track of all engaged clusters.
	Clusters clusters.Clusters[cluster.Cluster]
	// contains filtered or unexported fields
}

Provider is a sigs.k8s.io/multicluster-runtime/pkg/multicluster.Provider that yields each logical cluster (in the kcp sense) exposed via a virtual workspace as a cluster in the sigs.k8s.io/multicluster-runtime sense.

func NewProvider added in v0.7.0

func NewProvider(cfg *rest.Config, endpointSliceName string, opts Options) (*Provider, error)

NewProvider returns a Provider. The config must point at the control plane containing the endpoint slice object.

func (*Provider) Get added in v0.5.1

func (p *Provider) Get(ctx context.Context, clusterName multicluster.ClusterName) (cluster.Cluster, error)

Get returns the cluster with the given name as a cluster.Cluster.

func (*Provider) IndexField added in v0.5.1

func (p *Provider) IndexField(ctx context.Context, obj client.Object, field string, extractValue client.IndexerFunc) error

IndexField adds an indexer to the clusters managed by this provider.

func (*Provider) Lister added in v0.7.0

func (p *Provider) Lister() mcpcache.Lister

Lister returns a cache.Lister that lists objects across all shards.

func (*Provider) Start

func (p *Provider) Start(ctx context.Context, aware multicluster.Aware) error

Start starts the provider, watches for VW endpoints and

Jump to

Keyboard shortcuts

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