Documentation
¶
Index ¶
- func ConditionReadyFunc(conditionType string) func(client.Object) (bool, error)
- func DefaultExtractURLsFromEndpointSlice(obj client.Object) ([]string, error)
- type NewClusterFunc
- type Options
- type Provider
- func (p *Provider) Get(ctx context.Context, clusterName multicluster.ClusterName) (cluster.Cluster, error)
- func (p *Provider) GetAggregateInformer(obj runtime.Object) (mcpcache.AggregateSharedIndexInformer, error)
- func (p *Provider) IndexField(ctx context.Context, obj client.Object, field string, ...) error
- func (p *Provider) Lister() mcpcache.Lister
- func (p *Provider) Start(ctx context.Context, aware multicluster.Aware) error
- type URLExtractor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConditionReadyFunc ¶ added in v0.7.0
ConditionReadyFunc returns a function that checks if the given object has a condition with the given type and status True.
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 URLExtractor
// 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
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) GetAggregateInformer ¶ added in v0.9.0
func (p *Provider) GetAggregateInformer(obj runtime.Object) (mcpcache.AggregateSharedIndexInformer, error)
GetAggregateInformer returns an AggregateSharedIndexInformer for the given object type. The returned informer aggregates events from all current and future shards. Event handlers registered with this informer will receive events from all shards, and will automatically be registered with new shards as they are added.
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.
type URLExtractor ¶ added in v0.8.0
URLExtractor extracts virtual workspace URLs from an object.
func ExtractURLsByJSONPath ¶ added in v0.8.0
func ExtractURLsByJSONPath(path string) (URLExtractor, error)
ExtractURLsByJSONPath extracts virtual workspace URLs form any object given the passed JSON path, e.g. `{.status.endpoints[*].url}`