Documentation ¶
Index ¶
- type Check
- type CheckRunner
- type ConsulConfig
- type ConsulService
- func (c *ConsulService) KeepServices(services map[string]struct{}) error
- func (c *ConsulService) PeriodicSync()
- func (c *ConsulService) SetDelegatedChecks(delegateChecks map[string]struct{}, ...) *ConsulService
- func (c *ConsulService) Shutdown() error
- func (c *ConsulService) SyncTask(task *structs.Task) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Check ¶
type Check interface { Run() *cstructs.CheckResult ID() string Interval() time.Duration }
Check is an interface which check providers can implement for Nomad to run
type CheckRunner ¶
type CheckRunner struct {
// contains filtered or unexported fields
}
CheckRunner runs a given check in a specific interval and update a corresponding Consul TTL check
func NewCheckRunner ¶
func NewCheckRunner(check Check, runCheck func(Check), logger *log.Logger) *CheckRunner
NewCheckRunner configures and returns a CheckRunner
func (*CheckRunner) Start ¶
func (r *CheckRunner) Start()
Start is used to start the check. The check runs until stop is called
type ConsulConfig ¶
type ConsulConfig struct { Addr string Token string Auth string EnableSSL bool VerifySSL bool CAFile string CertFile string KeyFile string }
ConsulConfig is the configuration used to create a new ConsulService client
type ConsulService ¶
type ConsulService struct {
// contains filtered or unexported fields
}
ConsulService allows syncing of services and checks with Consul
func NewConsulService ¶
func NewConsulService(config *ConsulConfig, logger *log.Logger, allocID string) (*ConsulService, error)
NewConsulService returns a new ConsulService
func (*ConsulService) KeepServices ¶
func (c *ConsulService) KeepServices(services map[string]struct{}) error
KeepServices removes services from consul which are not present in the list of tasks passed to it
func (*ConsulService) PeriodicSync ¶
func (c *ConsulService) PeriodicSync()
PeriodicSync triggers periodic syncing of services and checks with Consul. This is a long lived go-routine which is stopped during shutdown
func (*ConsulService) SetDelegatedChecks ¶
func (c *ConsulService) SetDelegatedChecks(delegateChecks map[string]struct{}, createCheck func(*structs.ServiceCheck, string) (Check, error)) *ConsulService
SetDelegatedChecks sets the checks that nomad is going to run and report the result back to consul
func (*ConsulService) Shutdown ¶
func (c *ConsulService) Shutdown() error
Shutdown de-registers the services and checks and shuts down periodic syncing