Documentation ¶
Index ¶
- Variables
- type ClusterIDsManager
- type ClusterMesh
- func (cm *ClusterMesh) IPIdentitiesSynced(ctx context.Context) error
- func (cm *ClusterMesh) NewRemoteCluster(name string, status common.StatusFunc) common.RemoteCluster
- func (cm *ClusterMesh) NodesSynced(ctx context.Context) error
- func (cm *ClusterMesh) NumReadyClusters() int
- func (cm *ClusterMesh) ServicesSynced(ctx context.Context) error
- func (cm *ClusterMesh) Status() (status *models.ClusterMeshStatus)
- type ClusterMeshUsedIDs
- type Configuration
- type IPCacheWatcherOptsFn
- type Metrics
- type RemoteIdentityWatcher
- type ServiceMerger
Constants ¶
This section is empty.
Variables ¶
var Cell = cell.Module( "clustermesh", "ClusterMesh is the Cilium multicluster implementation", cell.Provide(NewClusterMesh), cell.ProvidePrivate(func(sc *k8s.ServiceCache) ServiceMerger { return sc }), cell.ProvidePrivate(func(ipcache *ipcache.IPCache) ipcache.IPCacher { return ipcache }), cell.ProvidePrivate(func(mgr nodemanager.NodeManager) (nodeStore.NodeManager, kvstore.ClusterSizeDependantIntervalFunc) { return mgr, mgr.ClusterSizeDependantInterval }), cell.ProvidePrivate(idsMgrProvider), cell.Config(common.Config{}), cell.Config(wait.TimeoutConfigDefault), metrics.Metric(NewMetrics), metrics.Metric(common.MetricsProvider(subsystem)), cell.Invoke(ipsetNotifier), cell.Invoke(nodeManagerNotifier), )
Functions ¶
This section is empty.
Types ¶
type ClusterIDsManager ¶
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 either the initial list of ipcache entries and identities has been received from all remote clusters, and synchronized with the BPF datapath, or the maximum wait period controlled by the clustermesh-sync-timeout flag elapsed. It returns an error if the given context expired.
func (*ClusterMesh) NewRemoteCluster ¶
func (cm *ClusterMesh) NewRemoteCluster(name string, status common.StatusFunc) common.RemoteCluster
func (*ClusterMesh) NodesSynced ¶
func (cm *ClusterMesh) NodesSynced(ctx context.Context) error
NodesSynced returns after that either the initial list of nodes has been received from all remote clusters, and synchronized with the different subscribers, or the maximum wait period controlled by the clustermesh-sync-timeout flag elapsed. It returns an error if the given context expired.
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 either the initial list of shared services has been received from all remote clusters, and synchronized with the BPF datapath, or the maximum wait period controlled by the clustermesh-sync-timeout flag elapsed. It returns an error if the given context expired.
func (*ClusterMesh) Status ¶
func (cm *ClusterMesh) Status() (status *models.ClusterMeshStatus)
Status returns the status of the ClusterMesh subsystem
type ClusterMeshUsedIDs ¶
type ClusterMeshUsedIDs struct { UsedClusterIDs map[uint32]struct{} UsedClusterIDsMutex lock.RWMutex // contains filtered or unexported fields }
func NewClusterMeshUsedIDs ¶
func NewClusterMeshUsedIDs(localClusterID uint32) *ClusterMeshUsedIDs
func (*ClusterMeshUsedIDs) ReleaseClusterID ¶
func (cm *ClusterMeshUsedIDs) ReleaseClusterID(clusterID uint32)
func (*ClusterMeshUsedIDs) ReserveClusterID ¶
func (cm *ClusterMeshUsedIDs) ReserveClusterID(clusterID uint32) error
type Configuration ¶
type Configuration struct { cell.In common.Config wait.TimeoutConfig // ClusterInfo is the id/name of the local cluster. This is used for logging and metrics ClusterInfo cmtypes.ClusterInfo // ServiceMerger is the interface responsible to merge service and // endpoints into an existing cache ServiceMerger ServiceMerger // NodeObserver reacts to node events. NodeObserver nodeStore.NodeManager // 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 // ServiceResolver, if not nil, is used to create a custom dialer for service resolution. ServiceResolver *dial.ServiceResolver // IPCacheWatcherExtraOpts returns extra options for watching ipcache entries. IPCacheWatcherExtraOpts IPCacheWatcherOptsFn `optional:"true"` // ClusterIDsManager handles the reservation of the ClusterIDs associated // with remote clusters, to ensure their uniqueness. ClusterIDsManager clusterIDsManager Metrics Metrics CommonMetrics common.Metrics StoreFactory store.Factory Logger logrus.FieldLogger }
Configuration is the configuration that must be provided to NewClusterMesh()
type IPCacheWatcherOptsFn ¶
type IPCacheWatcherOptsFn func(config *cmtypes.CiliumClusterConfig) []ipcache.IWOpt
IPCacheWatcherOptsFn is a function which returns extra options for watching ipcache entries.
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] }
func NewMetrics ¶
func NewMetrics() Metrics
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, remoteID uint32, 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.