Documentation ¶
Index ¶
- Constants
- func NewHAProxyConfigManager(options templaterouter.ConfigManagerOptions) *haproxyConfigManager
- type Backend
- func (b *Backend) Commit() error
- func (b *Backend) Disable() error
- func (b *Backend) DisableServer(name string) error
- func (b *Backend) EnableServer(name string) error
- func (b *Backend) FindServer(id string) (*backendServer, error)
- func (b *Backend) Name() string
- func (b *Backend) Refresh() error
- func (b *Backend) Reset()
- func (b *Backend) Servers() ([]BackendServerInfo, error)
- func (b *Backend) SetRoutingKey(k string) error
- func (b *Backend) UpdateServerInfo(id, ipaddr, port string, weight int32, relativeWeight bool) error
- func (b *Backend) UpdateServerState(id string, state BackendServerState) error
- type BackendServerInfo
- type BackendServerState
- type BlueprintPlugin
- func (p *BlueprintPlugin) Commit() error
- func (p *BlueprintPlugin) HandleEndpoints(eventType watch.EventType, endpoints *kapi.Endpoints) error
- func (p *BlueprintPlugin) HandleNamespaces(namespaces sets.String) error
- func (p *BlueprintPlugin) HandleNode(eventType watch.EventType, node *kapi.Node) error
- func (p *BlueprintPlugin) HandleRoute(eventType watch.EventType, route *routeapi.Route) error
- type ByteConverterFunc
- type CSVConverter
- type Client
- func (c *Client) Backends() ([]*Backend, error)
- func (c *Client) Commit() error
- func (c *Client) Execute(cmd string) ([]byte, error)
- func (c *Client) FindBackend(id string) (*Backend, error)
- func (c *Client) FindMap(name string) (*HAProxyMap, error)
- func (c *Client) Maps() ([]*HAProxyMap, error)
- func (c *Client) Reset()
- func (c *Client) RunCommand(cmd string, converter Converter) ([]byte, error)
- type Converter
- type HAProxyMap
- func (m *HAProxyMap) Add(k, v string, replace bool) error
- func (m *HAProxyMap) Commit() error
- func (m *HAProxyMap) Delete(k string) error
- func (m *HAProxyMap) DeleteEntry(id string) error
- func (m *HAProxyMap) Find(k string) ([]HAProxyMapEntry, error)
- func (m *HAProxyMap) Name() string
- func (m *HAProxyMap) Refresh() error
- type HAProxyMapEntry
Constants ¶
const ( // BackendServerStateReady indicates a server is ready. BackendServerStateReady BackendServerState = "ready" // BackendServerStateDrain indicates a server is ready but draining. BackendServerStateDrain BackendServerState = "drain" // BackendServerStateDown indicates a server is down. BackendServerStateDown BackendServerState = "down" // BackendServerStateMaint indicates a server is under maintainence. BackendServerStateMaint BackendServerState = "maint" // ListBackendsCommand is the command to get a list of all backends. ListBackendsCommand = "show backend" // GetServersStateCommand gets the state of all servers. This can be // optionally filtered by backends by passing a backend name. GetServersStateCommand = "show servers state" // SetServerCommand sets server specific information and state. SetServerCommand = "set server" )
Variables ¶
This section is empty.
Functions ¶
func NewHAProxyConfigManager ¶
func NewHAProxyConfigManager(options templaterouter.ConfigManagerOptions) *haproxyConfigManager
NewHAProxyConfigManager returns a new haproxyConfigManager.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend represents a specific haproxy backend.
func (*Backend) DisableServer ¶
DisableServer stops serving traffic for a haproxy backend server.
func (*Backend) EnableServer ¶
EnableServer enables serving traffic with a haproxy backend server.
func (*Backend) FindServer ¶
FindServer returns a specific haproxy backend server if found.
func (*Backend) Reset ¶
func (b *Backend) Reset()
Reset resets the cached server info in this haproxy backend.
func (*Backend) Servers ¶
func (b *Backend) Servers() ([]BackendServerInfo, error)
Servers returns the servers for this haproxy backend.
func (*Backend) SetRoutingKey ¶
SetRoutingKey sets the cookie routing key for the haproxy backend.
func (*Backend) UpdateServerInfo ¶
func (b *Backend) UpdateServerInfo(id, ipaddr, port string, weight int32, relativeWeight bool) error
UpdateServerInfo updates the information for a haproxy backend server.
func (*Backend) UpdateServerState ¶
func (b *Backend) UpdateServerState(id string, state BackendServerState) error
UpdateServerState specifies what should be the state of a haproxy backend server when all the changes made to the backend committed.
type BackendServerInfo ¶
type BackendServerInfo struct { Name string FQDN string IPAddress string Port int CurrentWeight int32 InitialWeight int32 State BackendServerState }
BackendServerInfo represents a server [endpoint] for a haproxy backend.
type BackendServerState ¶
type BackendServerState string
BackendServerState indicates the state for a haproxy backend server.
type BlueprintPlugin ¶
type BlueprintPlugin struct {
// contains filtered or unexported fields
}
BlueprintPlugin implements the router.Plugin interface to process routes from the blueprint namespace for the associated config manager.
func NewBlueprintPlugin ¶
func NewBlueprintPlugin(cm templaterouter.ConfigManager) *BlueprintPlugin
NewBlueprintPlugin returns a new blueprint routes plugin.
func (*BlueprintPlugin) Commit ¶
func (p *BlueprintPlugin) Commit() error
Commit commits the changes made to a watched resource.
func (*BlueprintPlugin) HandleEndpoints ¶
func (p *BlueprintPlugin) HandleEndpoints(eventType watch.EventType, endpoints *kapi.Endpoints) error
HandleEndpoints processes watch events on the Endpoints resource.
func (*BlueprintPlugin) HandleNamespaces ¶
func (p *BlueprintPlugin) HandleNamespaces(namespaces sets.String) error
HandleNamespaces processes watch events on namespaces.
func (*BlueprintPlugin) HandleNode ¶
HandleNode processes watch events on the Node resource.
func (*BlueprintPlugin) HandleRoute ¶
HandleRoute processes watch events on blueprint routes.
type ByteConverterFunc ¶
ByteConverterFunc converts bytes!
type CSVConverter ¶
type CSVConverter struct {
// contains filtered or unexported fields
}
CSVConverter is used to convert the haproxy dynamic configuration API responses into something that is valid CSV and then parse the response and unmarshal it into native golang structs.
func NewCSVConverter ¶
func NewCSVConverter(headers string, out interface{}, fn ByteConverterFunc) *CSVConverter
NewCSVConverter returns a new CSVConverter.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a client used to dynamically configure haproxy.
func (*Client) FindBackend ¶
FindBackend returns a specific haproxy backend if it is configured.
func (*Client) FindMap ¶
func (c *Client) FindMap(name string) (*HAProxyMap, error)
FindMap returns a populated haproxy map.
func (*Client) Maps ¶
func (c *Client) Maps() ([]*HAProxyMap, error)
Maps returns the list of configured haproxy maps.
type Converter ¶
type Converter interface { // Convert converts a set of bytes. Convert(data []byte) ([]byte, error) }
Converter transforms a set of bytes. The haproxy dynamic API command responses are not always csv/compliant. This allows us to inject custom converters to make the responses valid csv and parseable.
type HAProxyMap ¶
type HAProxyMap struct {
// contains filtered or unexported fields
}
HAProxyMap is a structure representing an haproxy map.
func (*HAProxyMap) Add ¶
func (m *HAProxyMap) Add(k, v string, replace bool) error
Add adds a new key and value to the haproxy map and allows all previous entries in the map to be deleted (replaced).
func (*HAProxyMap) Commit ¶
func (m *HAProxyMap) Commit() error
Commit commits all the pending changes made to this haproxy map. We do map changes "in-band" as that's handled dynamically by haproxy.
func (*HAProxyMap) Delete ¶
func (m *HAProxyMap) Delete(k string) error
Delete removes all the matching keys from the haproxy map.
func (*HAProxyMap) DeleteEntry ¶
func (m *HAProxyMap) DeleteEntry(id string) error
DeleteEntry removes a specific haproxy map entry.
func (*HAProxyMap) Find ¶
func (m *HAProxyMap) Find(k string) ([]HAProxyMapEntry, error)
Find returns a list of matching entries in the haproxy map.
func (*HAProxyMap) Refresh ¶
func (m *HAProxyMap) Refresh() error
Refresh refreshes the data in this haproxy map.
type HAProxyMapEntry ¶
type HAProxyMapEntry struct { // ID is the internal haproxy id associated with this map entry. // It is required for deleting map entries. ID string `csv:"id"` // Name is the entry key. Name string `csv:"name"` // Value is the entry value. Value string `csv:"value"` }
HAPrroxyMapEntry is an entry in HAProxyMap.