Documentation
¶
Index ¶
- func InstallDriver(ctx context.Context, conf *config.Config) error
- type Controller
- type Oncer
- type ReadOnly
- type ReadWrite
- func (rw *ReadWrite) EnableTestMode()
- func (rw *ReadWrite) Init(ctx context.Context) error
- func (rw *ReadWrite) Once(ctx context.Context) error
- func (rw *ReadWrite) Run(ctx context.Context) error
- func (rw *ReadWrite) ServeAPI(ctx context.Context) error
- func (ctrl ReadWrite) Stop()
- func (rw *ReadWrite) TaskNotifyChannel() (<-chan string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Controller ¶
type Controller interface { // Init initializes elements needed by controller. Returns a map of // taskname to driver Init(ctx context.Context) error // Run runs the controller by monitoring Consul and triggering the driver as needed Run(ctx context.Context) error // ServeAPI runs the API server for the controller ServeAPI(context.Context) error // Stop stops underlying clients and connections Stop() }
Controller describes the interface for monitoring Consul for relevant changes and triggering the driver to update network infrastructure.
func NewReadOnly ¶
func NewReadOnly(conf *config.Config) (Controller, error)
NewReadOnly configures and initializes a new ReadOnly controller
func NewReadWrite ¶
func NewReadWrite(conf *config.Config) (Controller, error)
NewReadWrite configures and initializes a new ReadWrite controller
type ReadOnly ¶
type ReadOnly struct {
// contains filtered or unexported fields
}
ReadOnly is the controller to run in read-only mode
func (*ReadOnly) Run ¶
Run runs the controller in read-only mode by checking Consul catalog once for latest and using the driver to plan network infrastructure changes
type ReadWrite ¶
type ReadWrite struct {
// contains filtered or unexported fields
}
ReadWrite is the controller to run in read-write mode
func (*ReadWrite) EnableTestMode ¶
func (rw *ReadWrite) EnableTestMode()
EnableTestMode is a helper for testing which tasks were triggered and executed. Callers of this method must consume from TaskNotifyChannel to prevent the buffered channel from filling and causing a dead lock.
func (*ReadWrite) Init ¶
Init initializes the controller before it can be run. Ensures that driver is initializes, works are created for each task.
func (*ReadWrite) Once ¶
Once runs the controller in read-write mode making sure each template has been fully rendered and the task run, then it returns.
func (*ReadWrite) Run ¶
Run runs the controller in read-write mode by continuously monitoring Consul catalog and using the driver to apply network infrastructure changes for any work that have been updated. Blocking call that runs main consul monitoring loop
func (*ReadWrite) TaskNotifyChannel ¶
TaskNotifyChannel returns a read only channel. The channel should only be consumed by one reader.