Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶ added in v0.9.0
type Config struct {
// Enabled is a flag to control whether hook should be used
Enabled bool `default:"true" envconfig:"consul_hook_enabled"`
// Consul ACL Token
ConsulToken string `default:"" envconfig:"consul_token"`
// ConsulGlobalTag is a tag added to every service registered in Consul.
// When executor fails (e.g., OOM, host restarted) task will NOT
// be deregistered. This should be done by remote service reconciling
// state between mesos and consul. We are using marathon-consul.
// It requires task to be tagged with common tag: "marathon" by default.
// > common tag name added to every service registered in Consul,
// > should be unique for every Marathon-cluster connected to Consul
// https://github.com/allegro/marathon-consul/blob/1.4.2/config/config.go#L74
ConsulGlobalTag string `default:"marathon" envconfig:"consul_global_tag"`
// Status that will be set for registered service health check
// By default we assume service health was checked initially by marathon
// It will be set to passing.
InitialHealthCheckStatus string `default:"passing" envconfig:"initial_health_check_status"`
}
Config is Consul hook configuration settable from environment
type Hook ¶
type Hook struct {
// contains filtered or unexported fields
}
Hook is an executor hook implementation that will register and deregister a service instance in Consul right after startup and just before task termination, respectively.
func (*Hook) DeregisterFromConsul ¶
func (h *Hook) DeregisterFromConsul(taskInfo mesosutils.TaskInfo) error
DeregisterFromConsul will deregister service IDs from Consul that were created during AfterTaskStartEvent hook event.
func (*Hook) HandleEvent ¶
HandleEvent calls appropriate hook functions that correspond to supported event types. Unsupported events are ignored.
func (*Hook) RegisterIntoConsul ¶
func (h *Hook) RegisterIntoConsul(taskInfo mesosutils.TaskInfo) error
RegisterIntoConsul generates an id and sends service information to Consul Agent
Click to show internal directories.
Click to hide internal directories.