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
- func IsSyncCloudNamespace(ns *corev1.Namespace) bool
- type Aggregator
- type CreateSyncJob
- type CtoKSource
- type CtoKSyncer
- func (s *CtoKSyncer) Delete(key string, _ interface{}) error
- func (s *CtoKSyncer) Informer() cache.SharedIndexInformer
- func (s *CtoKSyncer) Ready()
- func (s *CtoKSyncer) Run(ch <-chan struct{})
- func (s *CtoKSyncer) SetMicroAggregator(microAggregator Aggregator)
- func (s *CtoKSyncer) SetServices(svcs map[connector.MicroSvcName]connector.MicroSvcDomainName)
- func (s *CtoKSyncer) Upsert(key string, raw interface{}) error
- type DeleteSyncJob
- type SyncJob
Constants ¶
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" )
const (
// CloudServiceLabel defines cloud service label
CloudServiceLabel = "fsm-connector-cloud-service"
)
Variables ¶
This section is empty.
Functions ¶
func IsSyncCloudNamespace ¶
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
func (s *CtoKSource) Aggregate(ctx context.Context, svcName connector.MicroSvcName) map[connector.MicroSvcName]*connector.MicroSvcMeta
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) 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
func (s *CtoKSyncer) SetServices(svcs map[connector.MicroSvcName]connector.MicroSvcDomainName)
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