daemon

package
v3.5.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2019 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientV3Shim added in v0.6.0

type ClientV3Shim struct {
	RealClientV3
}

ClientV3Shim wraps a real client, allowing its syncer to be mocked.

func (ClientV3Shim) BGPSyncerByIface

func (s ClientV3Shim) BGPSyncerByIface(callbacks bapi.SyncerCallbacks) bapi.Syncer

func (ClientV3Shim) FelixSyncerByIface

func (s ClientV3Shim) FelixSyncerByIface(callbacks bapi.SyncerCallbacks) bapi.Syncer

type DatastoreClient added in v0.6.0

type DatastoreClient interface {
	clientv3.Interface
	FelixSyncerByIface(callbacks bapi.SyncerCallbacks) bapi.Syncer
	BGPSyncerByIface(callbacks bapi.SyncerCallbacks) bapi.Syncer
}

DatastoreClient is our interface to the datastore, used for mocking in the UTs.

type RealClientV3 added in v0.6.0

type RealClientV3 interface {
	clientv3.Interface
	Backend() bapi.Client
}

RealClientV3 is the real API of the V3 client, including the semi-private API that we use to get the backend.

type TyphaDaemon

type TyphaDaemon struct {
	BuildInfoLogCxt *log.Entry
	ConfigFilePath  string
	DatastoreClient DatastoreClient
	ConfigParams    *config.Config

	// The components of the server, created in CreateServer() below.
	SyncerPipelines    []*syncerPipeline
	CachesBySyncerType map[syncproto.SyncerType]syncserver.BreadcrumbProvider
	Server             *syncserver.Server

	// The functions below default to real library functions but they can be overridden for testing.
	NewClientV3           func(config apiconfig.CalicoAPIConfig) (DatastoreClient, error)
	ConfigureEarlyLogging func()
	ConfigureLogging      func(configParams *config.Config)
	// contains filtered or unexported fields
}

TyphaDaemon handles the lifecycle of the Typha process. The main() function of the Typha executable should simply call InitializeAndServeForever() to start the Typha server. The lifecycle is broken out into several individual methods for ease of testing.

func New

func New() *TyphaDaemon

func (*TyphaDaemon) CalculateHealthRC

func (t *TyphaDaemon) CalculateHealthRC() int

func (*TyphaDaemon) CreateServer

func (t *TyphaDaemon) CreateServer()

CreateServer creates and configures (but does not start) the server components.

func (*TyphaDaemon) DoEarlyRuntimeSetup

func (t *TyphaDaemon) DoEarlyRuntimeSetup()

DoEarlyRuntimeSetup does early runtime/logging configuration that needs to happen before we do any work.

func (*TyphaDaemon) InitializeAndServeForever

func (t *TyphaDaemon) InitializeAndServeForever(cxt context.Context) error

func (*TyphaDaemon) LoadConfiguration

func (t *TyphaDaemon) LoadConfiguration(ctx context.Context) error

LoadConfiguration uses the command-line configuration and environment variables to load our configuration. It initializes the datastore connection.

func (*TyphaDaemon) ParseCommandLineArgs

func (t *TyphaDaemon) ParseCommandLineArgs(argv []string)

ParseCommandLineArgs parses the command line args and either exits with a usage warning or stores the parsed arguments on fields of the struct.

func (*TyphaDaemon) Start

func (t *TyphaDaemon) Start(cxt context.Context)

Start starts all the server components in background goroutines.

func (*TyphaDaemon) WaitAndShutDown

func (t *TyphaDaemon) WaitAndShutDown(cxt context.Context)

WaitAndShutDown waits for OS signals or context.Done() and exits as appropriate.

Jump to

Keyboard shortcuts

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