Documentation ¶
Index ¶
- type HAproxy
- func (h *HAproxy) Chan() chan catalog.ChangeEvent
- func (h *HAproxy) Managed() bool
- func (h *HAproxy) Name() string
- func (h *HAproxy) Reload() error
- func (h *HAproxy) ResetSignals()
- func (h *HAproxy) Verify() error
- func (h *HAproxy) Watch(state *catalog.ServicesState)
- func (h *HAproxy) WriteAndReload(state *catalog.ServicesState) error
- func (h *HAproxy) WriteConfig(state *catalog.ServicesState, output io.Writer) error
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 (*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
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
Name is part of the catalog.Listener interface. Returns the listener name.
func (*HAproxy) Reload ¶
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 SIGTSTP, SIGTTIN, SIGTTOU.
func (*HAproxy) Verify ¶
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 ¶
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().