clustermesh

package
v1.14.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 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)),
)

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 hive.Lifecycle, c Configuration) *ClusterMesh

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

func (*ClusterMesh) ClustersSynced added in v1.7.0

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

ClustersSynced returns after all clusters were synchronized with the bpf datapath.

func (*ClusterMesh) NumReadyClusters

func (cm *ClusterMesh) NumReadyClusters() int

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

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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