clustermesh

package
v1.14.14 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2024 License: Apache-2.0 Imports: 25 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cell = cell.Module(
	"clustermesh",
	"ClusterMesh is the Cilium multicluster implementation",

	cell.Provide(NewClusterMesh),

	cell.ProvidePrivate(func(sc *k8s.ServiceCache) (ServiceMerger, k8s.ServiceIPGetter) { return sc, sc }),
	cell.ProvidePrivate(func(ipcache *ipcache.IPCache) ipcache.IPCacher { return ipcache }),
	cell.ProvidePrivate(func(mgr nodemanager.NodeManager) (store.Observer, kvstore.ClusterSizeDependantIntervalFunc) {
		return nodeStore.NewNodeObserver(mgr), mgr.ClusterSizeDependantInterval
	}),
	cell.ProvidePrivate(func() store.KeyCreator { return nodeStore.KeyCreator }),
	cell.ProvidePrivate(func(cfg *option.DaemonConfig) types.ClusterIDName {
		return types.ClusterIDName{ClusterID: cfg.ClusterID, ClusterName: cfg.ClusterName}
	}),

	cell.Config(internal.Config{}),

	cell.Metric(newMetrics),
	cell.Metric(internal.MetricsProvider(subsystem)),
)
View Source
var ConfigFiles = internal.ConfigFiles

ConfigFiles exposes the internal.ConfigFiles method, which is otherwise not accessible as it belongs to an internal package. This allows CLI commands to leverage it directly.

View Source
var (
	// ErrRemoteClusterDisconnected is the error returned by wait for sync
	// operations if the remote cluster is disconnected while still waiting.
	ErrRemoteClusterDisconnected = errors.New("remote cluster disconnected")
)

Functions

This section is empty.

Types

type ClusterMesh

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

ClusterMesh is a cache of multiple remote clusters

func NewClusterMesh

func NewClusterMesh(lifecycle cell.Lifecycle, c Configuration) *ClusterMesh

NewClusterMesh creates a new remote cluster cache based on the provided configuration

func (*ClusterMesh) IPIdentitiesSynced

func (cm *ClusterMesh) IPIdentitiesSynced(ctx context.Context) error

IPIdentitiesSynced returns after that the initial list of ipcache entries and identities has been received from all remote clusters, and synchronized with the BPF datapath.

func (*ClusterMesh) NodesSynced

func (cm *ClusterMesh) NodesSynced(ctx context.Context) error

NodesSynced returns after that the initial list of nodes has been received from all remote clusters, and synchronized with the different subscribers.

func (*ClusterMesh) NumReadyClusters

func (cm *ClusterMesh) NumReadyClusters() int

NumReadyClusters returns the number of remote clusters to which a connection has been established

func (*ClusterMesh) ServicesSynced

func (cm *ClusterMesh) ServicesSynced(ctx context.Context) error

ServicesSynced returns after that the initial list of shared services has been received from all remote clusters, and synchronized with the BPF datapath.

func (*ClusterMesh) Status

func (cm *ClusterMesh) Status() (status *models.ClusterMeshStatus)

Status returns the status of the ClusterMesh subsystem

type ClusterMeshUsedIDs

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

type Configuration

type Configuration struct {
	cell.In

	internal.Config

	// ClusterIDName is the id/name of the local cluster. This is used for logging and metrics
	types.ClusterIDName

	// NodeKeyCreator is the function used to create node instances as
	// nodes are being discovered in remote clusters
	NodeKeyCreator store.KeyCreator

	// ServiceMerger is the interface responsible to merge service and
	// endpoints into an existing cache
	ServiceMerger ServiceMerger

	// NodeObserver reacts to node events.
	NodeObserver store.Observer

	// RemoteIdentityWatcher provides identities that have been allocated on a
	// remote cluster.
	RemoteIdentityWatcher RemoteIdentityWatcher

	IPCache ipcache.IPCacher

	// ClusterSizeDependantInterval allows to calculate intervals based on cluster size.
	ClusterSizeDependantInterval kvstore.ClusterSizeDependantIntervalFunc

	// ServiceIPGetter, if not nil, is used to create a custom dialer for service resolution.
	ServiceIPGetter k8s.ServiceIPGetter

	Metrics         Metrics
	InternalMetrics internal.Metrics
}

Configuration is the configuration that must be provided to NewClusterMesh()

type Metrics

type Metrics struct {
	// TotalNodes tracks the number of total nodes in a remote cluster.
	TotalNodes metric.Vec[metric.Gauge]

	// TotalGlobalServices tracks the total number of global services.
	TotalGlobalServices metric.Vec[metric.Gauge]
}

type RemoteIdentityWatcher

type RemoteIdentityWatcher interface {
	// WatchRemoteIdentities returns a RemoteCache instance which can be later
	// started to watch identities in another kvstore and sync them to the local
	// identity cache. remoteName should be unique unless replacing an existing
	// remote's backend. When cachedPrefix is set, identities are assumed to be
	// stored under the "cilium/cache" prefix, and the watcher is adapted accordingly.
	WatchRemoteIdentities(remoteName string, backend kvstore.BackendOperations, cachedPrefix bool) (*allocator.RemoteCache, error)

	// RemoveRemoteIdentities removes any reference to a remote identity source,
	// emitting a deletion event for all previously known identities.
	RemoveRemoteIdentities(name string)
}

RemoteIdentityWatcher is any type which provides identities that have been allocated on a remote cluster.

type ServiceMerger

type ServiceMerger interface {
	MergeExternalServiceUpdate(service *serviceStore.ClusterService, swg *lock.StoppableWaitGroup)
	MergeExternalServiceDelete(service *serviceStore.ClusterService, swg *lock.StoppableWaitGroup)
}

ServiceMerger is the interface to be implemented by the owner of local services. The functions have to merge service updates and deletions with local services to provide a shared view.

type SyncedWaitFn

type SyncedWaitFn func(ctx context.Context) error

SyncedWaitFn is the type of a function to wait for the initial synchronization of a given resource type from all remote clusters.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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