Documentation ¶
Index ¶
- type ClientV3Shim
- type DatastoreClient
- type RealClientV3
- type TyphaDaemon
- func (t *TyphaDaemon) CreateServer()
- func (t *TyphaDaemon) DoEarlyRuntimeSetup()
- func (t *TyphaDaemon) InitializeAndServeForever(cxt context.Context) error
- func (t *TyphaDaemon) LoadConfiguration(ctx context.Context) error
- func (t *TyphaDaemon) ParseCommandLineArgs(argv []string)
- func (t *TyphaDaemon) Start(cxt context.Context)
- func (t *TyphaDaemon) WaitAndShutDown(cxt context.Context)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientV3Shim ¶
type ClientV3Shim struct {
RealClientV3
}
ClientV3Shim wraps a real client, allowing its syncer to be mocked.
func (ClientV3Shim) SyncerByIface ¶
func (s ClientV3Shim) SyncerByIface(callbacks bapi.SyncerCallbacks) bapi.Syncer
type DatastoreClient ¶
type DatastoreClient interface { clientv3.Interface SyncerByIface(callbacks bapi.SyncerCallbacks) bapi.Syncer }
DatastoreClient is our interface to the datastore, used for mocking in the UTs.
type RealClientV3 ¶
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. Syncer bapi.Syncer SyncerToValidator *calc.SyncerCallbacksDecoupler Validator *calc.ValidationFilter ValidatorToCache *calc.SyncerCallbacksDecoupler Cache *snapcache.Cache 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) 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.