consul

package
v0.11.3 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHook

func NewHook(cfg Config) (hook.Hook, error)

NewHook creates new Consul hook that is responsible for graceful Consul deregistration.

Types

type Config added in v0.9.0

type Config struct {
	// Consul ACL Token
	ConsulToken string `default:"" envconfig:"consul_token"`
}

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

func (h *Hook) HandleEvent(event hook.Event) (hook.Env, error)

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

Jump to

Keyboard shortcuts

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