lighthouse.haproxy.stanzas
¶lighthouse.haproxy.stanzas.stanza.
Stanza
(section_name)[source]¶Bases: object
Subclass for config file stanzas.
In an HAProxy config file, a stanza is in the form of:
stanza header
directive
directive
directive
Stanza instances have a header
attribute for the header and a list of
lines
, one for each directive line.
is_valid_line
(line)[source]¶Validates a given line against the associated “section” (e.g. ‘global’ or ‘frontend’, etc.) of a stanza.
If a line represents a directive that shouldn’t be within the stanza
it is rejected. See the directives.json
file for a condensed look
at valid directives based on section.
lighthouse.haproxy.stanzas.meta.
MetaFrontendStanza
(name, port, lines, members, bind_address=None)[source]¶Bases: lighthouse.haproxy.stanzas.stanza.Stanza
Stanza subclass representing a shared “meta” cluster frontend.
These frontends just contain ACL directives for routing requests to separate cluster backends. If a member cluster does not have an ACL rule defined in its haproxy config an error is logged and the member cluster is skipped.
lighthouse.haproxy.stanzas.frontend.
FrontendStanza
(cluster, bind_address=None)[source]¶Bases: lighthouse.haproxy.stanzas.stanza.Stanza
Stanza subclass representing a “frontend” stanza.
A frontend stanza defines an address to bind to an a backend to route traffic to. A cluster can defined custom lines via a “frontend” entry in their haproxy config dictionary.
lighthouse.haproxy.stanzas.backend.
BackendStanza
(cluster)[source]¶Bases: lighthouse.haproxy.stanzas.stanza.Stanza
Stanza subclass representing a “backend” stanza.
A backend stanza defines the nodes (or “servers”) belonging to a given cluster as well as how routing/load balancing between those nodes happens.
A given cluster can define custom directives via a list of lines in their haproxy config with the key “backend”.
lighthouse.haproxy.stanzas.peers.
PeersStanza
(cluster)[source]¶Bases: lighthouse.haproxy.stanzas.stanza.Stanza
Stanza subclass representing a “peers” stanza.
This stanza lists “peer” haproxy instances in a cluster, so that each instance can coordinate and share stick-table information. Useful for tracking cluster-wide stats.
lighthouse.haproxy.stanzas.proxy.
ProxyStanza
(name, port, upstreams, options=None, bind_address=None)[source]¶Bases: lighthouse.haproxy.stanzas.stanza.Stanza
Stanza for independent proxy directives.
These are used to add simple proxying to a system, e.g. communicating with a third party service via a dedicated internal machine with a white- listed IP.
lighthouse.haproxy.stanzas.stats.
StatsStanza
(port, uri='/')[source]¶Bases: lighthouse.haproxy.stanzas.stanza.Stanza
Stanza subclass representing a “listen” stanza specifically for the HAProxy stats feature.
Takes an optional uri parameter that defaults to the root uri.