provider

package
v0.5.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clusters

type Clusters = clusters.Clusters[cluster.Cluster]

Clusters is an alias for clusters.Clusters[cluster.Cluster].

type Factory added in v0.5.0

type Factory struct {
	Clusters *Clusters

	Providers map[string]*Provider

	Log      logr.Logger
	Handlers handlers.Handlers

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

	Config        *rest.Config
	Scheme        *runtime.Scheme
	Outer, Inner  client.Object
	Cache         cache.Cache
	WildcardCache mcpcache.WildcardCache
	NewCluster    NewClusterFunc
}

Factory generates Providers

func (*Factory) Get added in v0.5.0

func (f *Factory) Get(ctx context.Context, clusterName string) (cluster.Cluster, error)

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

func (*Factory) IndexField added in v0.5.0

func (f *Factory) 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 (*Factory) Start added in v0.5.0

func (f *Factory) Start(ctx context.Context, aware multicluster.Aware) error

Start starts watching for objects of type T.

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

	// WildcardCache is the wildcard cache to use for the provider. If this is
	// nil, a new wildcard cache will be created for the given rest.Config.
	WildcardCache mcpcache.WildcardCache

	// ObjectToWatch is the object type that the provider watches via a /clusters/*
	// wildcard endpoint to extract information about logical clusters joining and
	// leaving the "fleet" of (logical) clustergit pushs in kcp. If this is nil, it defaults
	// to [apisv1alpha1.APIBinding]. This might be useful when using this provider
	// against custom virtual workspaces that are not the APIExport one but share
	// the same endpoint semantics.
	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

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

Options are the options for creating a new instance of the apiexport provider.

type Provider

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

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

This is internal representation of the provider, use apiexport.Provider for the public one. This provider deals with single virtual workspace, representinged by the rest.Config provided.

func New

func New(cfg *rest.Config, clusters *Clusters, options Options) (*Provider, error)

New creates a new kcp virtual workspace provider. The provided rest.Config must point to a virtual workspace apiserver base path, i.e. up to but without the '/clusters/*' suffix. This information can be extracted from the APIExport status (deprecated) or an APIExportEndpointSlice status.

func (*Provider) Start

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

Start starts the provider and blocks.

Jump to

Keyboard shortcuts

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