ctok

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package ctok implements a syncer from cloud to k8s.

Package ctok contains a reusable abstraction for efficiently watching for changes in resources in a Kubernetes cluster.

Index

Constants

View Source
const (
	// K8SQuietPeriod is the time to wait for no service changes before syncing.
	K8SQuietPeriod = messaging.ConnectorUpdateMaxWindow

	// K8SMaxPeriod is the maximum time to wait before forcing a sync, even
	// if there are active changes going on.
	K8SMaxPeriod = messaging.ConnectorUpdateMaxWindow

	True  = "true"
	False = "false"
)
View Source
const (
	// CloudServiceLabel defines cloud service label
	CloudServiceLabel = "fsm-connector-cloud-service"
)

Variables

This section is empty.

Functions

func IsSyncCloudNamespace

func IsSyncCloudNamespace(ns *corev1.Namespace) bool

IsSyncCloudNamespace if sync namespace

Types

type Aggregator

type Aggregator interface {
	// Aggregate micro services
	Aggregate(context.Context, connector.MicroSvcName) map[connector.MicroSvcName]*connector.MicroSvcMeta
}

Aggregator aggregates micro services

type CreateSyncJob added in v1.3.8

type CreateSyncJob struct {
	*SyncJob
	// contains filtered or unexported fields
}

CreateSyncJob is the job to sync

func (*CreateSyncJob) Run added in v1.3.8

func (job *CreateSyncJob) Run()

Run is the logic unit of job

type CtoKSource added in v1.2.1

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

CtoKSource is the source for the sync that watches cloud services and updates a CtoKSyncer whenever the set of services to register changes.

func NewCtoKSource added in v1.2.1

func NewCtoKSource(controller connector.ConnectController,
	syncer *CtoKSyncer,
	discClient connector.ServiceDiscoveryClient,
	domain string) *CtoKSource

func (*CtoKSource) Aggregate added in v1.2.1

Aggregate micro services

func (*CtoKSource) Run added in v1.2.1

func (s *CtoKSource) Run(ctx context.Context)

Run is the long-running loop for watching cloud services and updating the CtoKSyncer.

type CtoKSyncer added in v1.2.1

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

CtoKSyncer is the destination where services are registered.

While in practice we only have one syncer (K8S), the interface abstraction makes it easy and possible to test the CtoKSource in isolation.

func NewCtoKSyncer added in v1.2.1

func NewCtoKSyncer(
	controller connector.ConnectController,
	discClient connector.ServiceDiscoveryClient,
	kubeClient kubernetes.Interface,
	ctx context.Context,
	fsmNamespace string,
	nWorkers uint) *CtoKSyncer

NewCtoKSyncer creates a new mesh syncer

func (*CtoKSyncer) Delete added in v1.2.1

func (s *CtoKSyncer) Delete(key string, _ interface{}) error

Delete implements the controller.Resource interface.

func (*CtoKSyncer) Informer added in v1.2.1

func (s *CtoKSyncer) Informer() cache.SharedIndexInformer

Informer implements the controller.Resource interface. It tells Kubernetes that we want to watch for changes to Services.

func (*CtoKSyncer) Ready added in v1.2.1

func (s *CtoKSyncer) Ready()

Ready wait util ready

func (*CtoKSyncer) Run added in v1.2.1

func (s *CtoKSyncer) Run(ch <-chan struct{})

Run implements the controller.Backgrounder interface.

func (*CtoKSyncer) SetMicroAggregator added in v1.2.1

func (s *CtoKSyncer) SetMicroAggregator(microAggregator Aggregator)

func (*CtoKSyncer) SetServices added in v1.2.1

SetServices is called with the services that should be created. The key is the service name and the destination is the external DNS entry to point to.

func (*CtoKSyncer) Upsert added in v1.2.1

func (s *CtoKSyncer) Upsert(key string, raw interface{}) error

Upsert implements the controller.Resource interface.

type DeleteSyncJob added in v1.3.8

type DeleteSyncJob struct {
	*SyncJob
	// contains filtered or unexported fields
}

DeleteSyncJob is the job to sync

func (*DeleteSyncJob) Run added in v1.3.8

func (job *DeleteSyncJob) Run()

Run is the logic unit of job

type SyncJob added in v1.3.8

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

SyncJob is the job to sync

func (*SyncJob) GetDoneCh added in v1.3.8

func (job *SyncJob) GetDoneCh() <-chan struct{}

GetDoneCh returns the channel, which when closed, indicates the job has been finished.

func (*SyncJob) JobName added in v1.3.8

func (job *SyncJob) JobName() string

JobName implementation for this job, for logging purposes

Jump to

Keyboard shortcuts

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