haproxy

package
v2.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2018 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HAproxy

type HAproxy struct {
	ReloadCmd    string `toml:"reload_cmd"`
	VerifyCmd    string `toml:"verify_cmd"`
	BindIP       string `toml:"bind_ip"`
	Template     string `toml:"template"`
	ConfigFile   string `toml:"config_file"`
	PidFile      string `toml:"pid_file"`
	User         string `toml:"user"`
	Group        string `toml:"group"`
	UseHostnames bool   `toml:"use_hostnames"`
	// contains filtered or unexported fields
}

Configuration and state for the HAproxy management module

func New

func New(configFile string, pidFile string) *HAproxy

Constructs a properly configured HAProxy and returns a pointer to it

func (*HAproxy) Chan added in v1.1.0

func (h *HAproxy) Chan() chan catalog.ChangeEvent

Chan is part of the catalog.Listener interface. Returns the channel we listen on.

func (*HAproxy) Managed added in v1.3.0

func (h *HAproxy) Managed() bool

Managed is part of the catalog.Listener interface. It tells the ServicesState if this listener should be auto-added or removed. We never want that for haproxy.

func (*HAproxy) Name added in v1.1.0

func (h *HAproxy) Name() string

Name is part of the catalog.Listener interface. Returns the listener name.

func (*HAproxy) Reload

func (h *HAproxy) Reload() error

Run the HAproxy reload command to load the new config and restart. Best to use a command with -sf specified to keep the connections up.

func (*HAproxy) ResetSignals added in v1.3.0

func (h *HAproxy) ResetSignals()

ResetSignals unhooks our signal handler from the signals the sub-commands initiate. This is potentially destructive if other places in the program have hooked to the same signals! Affected signals are SIGSTOP, SIGTSTP, SIGTTIN, SIGTTOU.

func (*HAproxy) Verify

func (h *HAproxy) Verify() error

Run HAproxy with the verify command that will check the validity of the current config. Used to gate a Reload() so we don't load a bad config and tear everything down.

func (*HAproxy) Watch

func (h *HAproxy) Watch(state *catalog.ServicesState)

Watch the state of a ServicesState struct and generate a new proxy config file (haproxy.ConfigFile) when the state changes. Also notifies the service that it needs to reload once the new file has been written and verified.

func (*HAproxy) WriteAndReload

func (h *HAproxy) WriteAndReload(state *catalog.ServicesState) error

Write out the the HAproxy config and reload the service.

func (*HAproxy) WriteConfig

func (h *HAproxy) WriteConfig(state *catalog.ServicesState, output io.Writer) error

Create an HAproxy config from the supplied ServicesState. Write it out to the supplied io.Writer interface. This gets a list from servicesWithPorts() and builds a list of unique ports for all services, then passes these to the template. Ports are looked up by the func getPorts().

Jump to

Keyboard shortcuts

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