Documentation ¶
Index ¶
- Variables
- func ConfigFiles(cfgdir string) (configs map[string]string, err error)
- func MetricsProvider(subsystem string) func() Metrics
- func NewSharedServicesObserver(log logrus.FieldLogger, cache *GlobalServiceCache, ...) store.Observer
- type ClusterMesh
- type Config
- type Configuration
- type GlobalService
- type GlobalServiceCache
- func (c *GlobalServiceCache) GetGlobalService(serviceNN types.NamespacedName) *GlobalService
- func (c *GlobalServiceCache) GetService(serviceNN types.NamespacedName, clusterName string) *serviceStore.ClusterService
- func (c *GlobalServiceCache) Has(svc *serviceStore.ClusterService) bool
- func (c *GlobalServiceCache) OnDelete(svc *serviceStore.ClusterService) bool
- func (c *GlobalServiceCache) OnUpdate(svc *serviceStore.ClusterService)
- func (c *GlobalServiceCache) Size() (num int)
- type Metrics
- type RemoteCluster
- type RemoteClusterCreatorFunc
- type StatusFunc
Constants ¶
This section is empty.
Variables ¶
var ( ErrClusterIDChanged = errors.New("etcd cluster ID has changed") ErrEtcdInvalidResponse = errors.New("received an invalid etcd response") )
Functions ¶
func ConfigFiles ¶ added in v1.15.6
ConfigFiles returns the list of configuration files in the given path. It shall be used by CLI tools only, as it doesn't handle subsequent updates.
func MetricsProvider ¶
func NewSharedServicesObserver ¶ added in v1.16.0
func NewSharedServicesObserver( log logrus.FieldLogger, cache *GlobalServiceCache, onUpdate, onDelete func(*serviceStore.ClusterService), ) store.Observer
NewSharedServicesObserver returns an observer implementing the logic to convert and filter shared services notifications, update the global service cache and call the upstream handlers when appropriate.
Types ¶
type ClusterMesh ¶
type ClusterMesh interface { cell.HookInterface // ForEachRemoteCluster calls the provided function for each remote cluster // in the ClusterMesh. ForEachRemoteCluster(fn func(RemoteCluster) error) error // NumReadyClusters returns the number of remote clusters to which a connection // has been established NumReadyClusters() int }
func NewClusterMesh ¶
func NewClusterMesh(c Configuration) ClusterMesh
NewClusterMesh creates a new remote cluster cache based on the provided configuration
type Config ¶
type Config struct { // ClusterMeshConfig is the path to the clustermesh configuration directory. ClusterMeshConfig string }
type Configuration ¶
type Configuration struct { Config // ClusterInfo is the id/name of the local cluster. This is used for logging and metrics ClusterInfo types.ClusterInfo // NewRemoteCluster is a function returning a new implementation of the remote cluster business logic. NewRemoteCluster RemoteClusterCreatorFunc // nodeName is the name of the local node. This is used for logging and metrics NodeName string // 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 // Metrics holds the different clustermesh metrics. Metrics Metrics }
Configuration is the configuration that must be provided to NewClusterMesh()
type GlobalService ¶ added in v1.16.0
type GlobalService struct {
ClusterServices map[string]*serviceStore.ClusterService
}
type GlobalServiceCache ¶ added in v1.16.0
type GlobalServiceCache struct {
// contains filtered or unexported fields
}
func NewGlobalServiceCache ¶ added in v1.16.0
func NewGlobalServiceCache(metricTotalGlobalServices metric.Gauge) *GlobalServiceCache
func (*GlobalServiceCache) GetGlobalService ¶ added in v1.16.0
func (c *GlobalServiceCache) GetGlobalService(serviceNN types.NamespacedName) *GlobalService
GetGlobalService returns a global service object. This function returns a shallow copy of the GlobalService object, thus the ClusterService objects should not be mutated.
func (*GlobalServiceCache) GetService ¶ added in v1.16.0
func (c *GlobalServiceCache) GetService(serviceNN types.NamespacedName, clusterName string) *serviceStore.ClusterService
GetService returns the service for a specific cluster. This function does not make a copy of the cluster service object and should not be mutated.
func (*GlobalServiceCache) Has ¶ added in v1.16.0
func (c *GlobalServiceCache) Has(svc *serviceStore.ClusterService) bool
Has returns whether a given service is present in the cache.
func (*GlobalServiceCache) OnDelete ¶ added in v1.16.0
func (c *GlobalServiceCache) OnDelete(svc *serviceStore.ClusterService) bool
func (*GlobalServiceCache) OnUpdate ¶ added in v1.16.0
func (c *GlobalServiceCache) OnUpdate(svc *serviceStore.ClusterService)
func (*GlobalServiceCache) Size ¶ added in v1.16.0
func (c *GlobalServiceCache) Size() (num int)
Size returns the number of global services in the cache
type Metrics ¶
type Metrics struct { // TotalRemoteClusters tracks the total number of remote clusters. TotalRemoteClusters metric.Vec[metric.Gauge] // LastFailureTimestamp tracks the last failure timestamp. LastFailureTimestamp metric.Vec[metric.Gauge] // ReadinessStatus tracks the readiness status of remote clusters. ReadinessStatus metric.Vec[metric.Gauge] // TotalFailure tracks the number of failures when connecting to remote clusters. TotalFailures metric.Vec[metric.Gauge] }
type RemoteCluster ¶
type RemoteCluster interface { // Run implements the actual business logic once the connection to the remote cluster has been established. // The ready channel shall be closed when the initialization tasks completed, possibly returning an error. Run(ctx context.Context, backend kvstore.BackendOperations, config types.CiliumClusterConfig, ready chan<- error) Stop() Remove() }
type RemoteClusterCreatorFunc ¶
type RemoteClusterCreatorFunc func(name string, status StatusFunc) RemoteCluster
type StatusFunc ¶
type StatusFunc func() *models.RemoteCluster