federate

package
v0.15.25 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package federate provides an interface that abstracts the distribution of Kubernetes resources.

Index

Constants

View Source
const ClusterIDLabelKey = "submariner-io/clusterID"

ClusterIDLabelKey is the key for a label that may be added to federated resources to hold the ID of the cluster from which the resource originated, allowing for filtering of resources emanating from the originating cluster.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterEventHandler

type ClusterEventHandler interface {
	// OnAdd is called when a cluster is added. The given 'kubeConfig' can be used to access
	// the cluster's kube API endpoint.
	OnAdd(clusterID string, kubeConfig *rest.Config)

	// OnUpdate is called when some aspect of a cluster's kube API endpoint configuration has changed.
	OnUpdate(clusterID string, kubeConfig *rest.Config)

	// OnRemove is called when a cluster is removed.
	OnRemove(clusterID string)
}

ClusterEventHandler handles federated cluster lifecycle event notifications.

type ClusterInformer

type ClusterInformer interface {
	// AddHandler adds a ClusterEventHandler to be notified when cluster lifecycle events occur.
	// The handler is notified asynchronously of the existing set of clusters via OnAdd events, one per cluster.
	AddHandler(handler ClusterEventHandler) error
}

ClusterInformer provides functionality to inform on federated cluster lifecycle events.

type Federator

type Federator interface {
	// Distribute distributes the given resource to all federated clusters.
	// The actual distribution may occur asynchronously in which case any returned error only indicates that the request
	// failed.
	//
	// If the resource was previously distributed and the given resource differs, each previous cluster will receive the
	// updated resource.
	Distribute(resource runtime.Object) error

	// Delete stops distributing the given resource and deletes it from all clusters to which it was distributed.
	// The actual deletion may occur asynchronously in which any returned error only indicates that the request
	// failed.
	Delete(resource runtime.Object) error
}

Federator provides methods for accessing federated resources.

func NewCreateFederator

func NewCreateFederator(dynClient dynamic.Interface, restMapper meta.RESTMapper, targetNamespace string) Federator

func NewCreateOrUpdateFederator

func NewCreateOrUpdateFederator(dynClient dynamic.Interface, restMapper meta.RESTMapper, targetNamespace,
	localClusterID string, keepMetadataField ...string,
) Federator

func NewNoopFederator

func NewNoopFederator() Federator

func NewUpdateFederator

func NewUpdateFederator(dynClient dynamic.Interface, restMapper meta.RESTMapper, targetNamespace string, update UpdateFn) Federator

func NewUpdateStatusFederator

func NewUpdateStatusFederator(dynClient dynamic.Interface, restMapper meta.RESTMapper, targetNamespace string) Federator

Directories

Path Synopsis
Package fake provides a fake Federator for use in tests.
Package fake provides a fake Federator for use in tests.

Jump to

Keyboard shortcuts

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