controller

package
v0.0.0-...-4a28188 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitConsulServices

func InitConsulServices(c *SyncController, consulFakeData map[string][]string)

InitConsulServices Initialize fake consul data into the controller

func InitGlobalNetworkSet

func InitGlobalNetworkSet(c *SyncController, calicoFakeData map[string][]string)

InitGlobalNetworkSet Initialize fake calico data into the controller

Types

type SyncController

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

SyncController is used to sync data to calico it holds up to date data from consul

func New

func New(calicoC calico.Controller, consulC consul.Controller, logger *logrus.Entry, consulChange map[string]int,
	serviceMap map[string][]*capi.CatalogService, consulCalicoMap map[string]string,
	mapAction map[string]map[string]time.Time, mutexCache *sync.RWMutex) *SyncController

New returns new SyncController object

func NewFakeController

func NewFakeController(consulCalicoConf map[string]string) *SyncController

NewFakeController returns new fake SyncController object

func (*SyncController) AddCache

func (c *SyncController) AddCache(consulService string)

AddCache adds consul service to process cache

func (*SyncController) DeleteCache

func (c *SyncController) DeleteCache(consulService string)

DeleteCache removes consul service from process cache

func (*SyncController) GetCatalogService

func (c *SyncController) GetCatalogService(consulService string) []*capi.CatalogService

GetCatalogService returns the Catalog of the service in consul

func (*SyncController) GetServicesChanged

func (c *SyncController) GetServicesChanged() map[string]int

GetServicesChanged returns list of services that changed in consul

func (*SyncController) RefreshCacheCalico

func (c *SyncController) RefreshCacheCalico(stop chan os.Signal)

RefreshCacheCalico Adds all the consul services to the process cache

func (*SyncController) Run

func (c *SyncController) Run(ctx context.Context, stop chan os.Signal)

Run start 3 processes (Consul watch , RefreshCacheCalico, SyncOnTrigger)

func (*SyncController) SyncGlobalNetworkSet

func (c *SyncController) SyncGlobalNetworkSet(ctx context.Context, consulService string,
	calicoGNetworkSet string, stop chan os.Signal)

SyncGlobalNetworkSet will update the list of Ips in calico based on data from Consul

func (*SyncController) SyncOnTrigger

func (c *SyncController) SyncOnTrigger(ctx context.Context, stop chan os.Signal)

SyncOnTrigger will trigger SyncGlobalNetworkSet for any service that has changed in Consul in the controllerCheckCacheTime time period

type SyncControllerFake

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

SyncControllerFake fakes the sync controller.

Jump to

Keyboard shortcuts

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