operator

package
v1.17.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cell = cell.Module(
	"clustermesh",
	"Cell providing clustermesh capabilities in the operator",
	cell.Config(ClusterMeshConfig{}),
	cell.Config(MCSAPIConfig{}),
	cell.Provide(
		newClusterMesh,
		newAPIClustersHandler,
	),

	cell.Config(common.DefaultConfig),
	cell.Config(wait.TimeoutConfigDefault),

	metrics.Metric(NewMetrics),
	metrics.Metric(common.MetricsProvider(subsystem)),
)

Cell is the cell for the Operator ClusterMesh

Functions

func NewServiceExportsObserver added in v1.17.0

func NewServiceExportsObserver(
	cache *GlobalServiceExportCache, onUpdate, onDelete func(*mcsapitypes.MCSAPIServiceSpec),
) store.Observer

NewServiceExportsObserver returns an observer implementing the logic to convert and filter export notifications, update the global service export cache and call the upstream handlers when appropriate.

Types

type ClusterMesh

type ClusterMesh interface {
	// RegisterClusterAddHook register a hook when a cluster is added to the mesh.
	// This should NOT be called after the Start hook.
	RegisterClusterAddHook(clusterAddHook func(string))
	// RegisterClusterDeleteHook register a hook when a cluster is removed from the mesh.
	// This should NOT be called after the Start hook.
	RegisterClusterDeleteHook(clusterDeleteHook func(string))
	// RegisterClusterServiceUpdateHook register a hook when a service in the mesh is updated.
	// This should NOT be called after the Start hook.
	RegisterClusterServiceUpdateHook(clusterServiceUpdateHook func(*serviceStore.ClusterService))
	// RegisterClusterServiceDeleteHook register a hook when a service in the mesh is deleted.
	// This should NOT be called after the Start hook.
	RegisterClusterServiceDeleteHook(clusterServiceDeleteHook func(*serviceStore.ClusterService))
	// RegisterClusterServiceExportUpdateHook register a hook when a service export in the mesh is updated.
	// This should NOT be called after the Start hook.
	RegisterClusterServiceExportUpdateHook(clusterServiceExportUpdateHook func(*mcsapitypes.MCSAPIServiceSpec))
	// RegisterClusterServiceExportDeleteHook register a hook when a service export in the mesh is deleted.
	// This should NOT be called after the Start hook.
	RegisterClusterServiceExportDeleteHook(clusterServiceExportDeleteHook func(*mcsapitypes.MCSAPIServiceSpec))

	ServicesSynced(ctx context.Context) error
	GlobalServices() *common.GlobalServiceCache

	ServiceExportsSynced(ctx context.Context) error
	GlobalServiceExports() *GlobalServiceExportCache
}

ClusterMesh is the interface corresponding to the clusterMesh struct to expose its public methods to other Cilium packages.

type ClusterMeshConfig

type ClusterMeshConfig struct {
	// ClusterMeshEnableEndpointSync enables the EndpointSlice Cluster Mesh synchronization
	ClusterMeshEnableEndpointSync bool `mapstructure:"clustermesh-enable-endpoint-sync"`
}

ClusterMeshConfig contains the configuration for ClusterMesh inside the operator.

func (ClusterMeshConfig) Flags

func (cfg ClusterMeshConfig) Flags(flags *pflag.FlagSet)

Flags adds the flags used by ClientConfig.

type GlobalServiceExportCache added in v1.17.0

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

func NewGlobalServiceExportCache added in v1.17.0

func NewGlobalServiceExportCache(metricTotalGlobalServiceExports metric.Gauge) *GlobalServiceExportCache

func (*GlobalServiceExportCache) GetServiceExportByCluster added in v1.17.0

func (c *GlobalServiceExportCache) GetServiceExportByCluster(serviceExportNN types.NamespacedName) ServiceExportsByCluster

GetServiceExportByCluster returns a shallow copy of the GlobalServiceExport object, thus the MCSAPIServiceSpec objects should not be mutated.

func (*GlobalServiceExportCache) GetServiceExportsName added in v1.17.0

func (c *GlobalServiceExportCache) GetServiceExportsName(namespace string) []string

GetServiceExportsName returns all the service exports for a specific namespace that have at least one service export in one of the remote cluster in the mesh.

func (*GlobalServiceExportCache) OnDelete added in v1.17.0

func (*GlobalServiceExportCache) OnUpdate added in v1.17.0

func (c *GlobalServiceExportCache) OnUpdate(svcExport *mcsapitypes.MCSAPIServiceSpec)

func (*GlobalServiceExportCache) Size added in v1.17.0

func (c *GlobalServiceExportCache) Size() uint64

type MCSAPIConfig added in v1.17.0

type MCSAPIConfig struct {
	// ClusterMeshEnableMCSAPI enables the MCS API support
	ClusterMeshEnableMCSAPI bool `mapstructure:"clustermesh-enable-mcs-api"`
}

MCSAPIConfig contains the configuration for MCS-API

func (MCSAPIConfig) Flags added in v1.17.0

func (cfg MCSAPIConfig) Flags(flags *pflag.FlagSet)

Flags adds the flags used by ClientConfig.

type Metrics

type Metrics struct {
	// TotalGlobalServices tracks the total number of global services.
	TotalGlobalServices metric.Vec[metric.Gauge]
	// TotalGlobalServiceExports tracks the total number of global service exports.
	TotalGlobalServiceExports metric.Vec[metric.Gauge]
}

func NewMetrics

func NewMetrics() Metrics

type ServiceExportsByCluster added in v1.17.0

type ServiceExportsByCluster map[string]*mcsapitypes.MCSAPIServiceSpec

type ServiceExportsByName added in v1.17.0

type ServiceExportsByName map[string]ServiceExportsByCluster

type ServiceExportsByNamespace added in v1.17.0

type ServiceExportsByNamespace map[string]ServiceExportsByName

Jump to

Keyboard shortcuts

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