config

package
v0.0.0-...-7c96eb5 Latest Latest
Warning

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

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

Documentation

Overview

Package config implements functions to manage the configuration for a Seesaw v2 engine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

type Cluster struct {
	Site         string
	VIP          seesaw.Host
	BGPLocalASN  uint32
	BGPRemoteASN uint32
	BGPPeers     map[string]*seesaw.Host // by Hostname
	Nodes        map[string]*seesaw.Node // by Node.Key()
	VIPSubnets   map[string]*net.IPNet   // by IPNet.String()
	VLANs        map[uint16]*seesaw.VLAN // by VLAN.Key()
	Vservers     map[string]*Vserver     // by Vserver.Key()
	Status       seesaw.ConfigStatus
}

Cluster represents the configuration for a load balancing cluster.

func NewCluster

func NewCluster(site string) *Cluster

NewCluster returns an initialised Cluster structure.

func (*Cluster) AddBGPPeer

func (c *Cluster) AddBGPPeer(peer *seesaw.Host) error

AddBGPPeer adds a BGP peer to a Seesaw Cluster.

func (*Cluster) AddNode

func (c *Cluster) AddNode(node *seesaw.Node) error

AddNode adds a Seesaw Node to a Seesaw Cluster.

func (*Cluster) AddVIPSubnet

func (c *Cluster) AddVIPSubnet(subnet *net.IPNet) error

AddVIPSubnet adds a VIP Subnet to a Seesaw Cluster.

func (*Cluster) AddVLAN

func (c *Cluster) AddVLAN(vlan *seesaw.VLAN) error

AddVLAN adds a VLAN to a Seesaw Cluster.

func (*Cluster) AddVserver

func (c *Cluster) AddVserver(vserver *Vserver) error

AddVserver adds a Vserver to a Seesaw Cluster.

func (*Cluster) Equal

func (c *Cluster) Equal(other *Cluster) bool

Equal reports whether this cluster is equal to the given cluster.

type EngineConfig

type EngineConfig struct {
	AnycastEnabled          bool          // Flag to enable or disable anycast.
	BGPUpdateInterval       time.Duration // The BGP update interval.
	CACertFile              string        // The path to the SSL/TLS CA cert file.
	ClusterFile             string        // The path to the cluster protobuf file.
	ClusterName             string        // The name of the cluster the engine is running in.
	ClusterVIP              seesaw.Host   // The VIP for this Seesaw Cluster.
	ConfigInterval          time.Duration // The cluster configuration update interval.
	ConfigFile              string        // The path to the engine config file.
	ConfigServers           []string      // The list of configuration servers (hostnames) in priority order.
	ConfigServerPort        int           // The configuration server port number.
	ConfigServerTimeout     time.Duration // The configuration server client timeout (per TCP connection).
	DummyInterface          string        // The dummy network interface.
	GratuitousARPInterval   time.Duration // The interval for gratuitous ARP messages.
	HAStateTimeout          time.Duration // The timeout for receiving HAState updates.
	LBInterface             string        // The network interface to use for load balancing.
	MaxPeerConfigSyncErrors int           // The number of allowable peer config sync errors.
	NCCSocket               string        // The Network Control Center socket.
	NodeInterface           string        // The primary network interface for this node.
	Node                    seesaw.Host   // The node the engine is running on.
	Peer                    seesaw.Host   // The node's peer.
	RoutingTableID          uint8         // The routing table ID to use for load balanced traffic.
	ServiceAnycastIPv4      []net.IP      // IPv4 anycast addresses that are always advertised.
	ServiceAnycastIPv6      []net.IP      // IPv6 anycast addresses that are always advertised.
	SocketPath              string        // The path to the engine socket.
	StatsInterval           time.Duration // The statistics update interval.
	SyncPort                int           // The port for sync'ing with this node's peer.
	VMAC                    string        // The VMAC address to use for the load balancing network interface.
	VRID                    uint8         // The VRRP virtual router ID for the cluster.
	VRRPDestIP              net.IP        // The destination IP for VRRP advertisements.
}

EngineConfig provides configuration details for an Engine.

func DefaultEngineConfig

func DefaultEngineConfig() EngineConfig

DefaultEngineConfig returns the default engine configuration.

type Healthcheck

type Healthcheck struct {
	Name      string
	Mode      seesaw.HealthcheckMode
	Type      seesaw.HealthcheckType
	Port      uint16        // The backend port to connect to.
	Interval  time.Duration // How frequently this healthcheck is executed.
	Timeout   time.Duration // The execution timeout.
	Retries   int           // Number of times to retry a healthcheck.
	Send      string        // The request to be sent to the backend.
	Receive   string        // The expected response from the backend.
	Code      int           // The expected response code from the backend.
	Proxy     bool          // Perform healthchecks against an HTTP proxy.
	Method    string        // The request method for an HTTP/S healthcheck.
	TLSVerify bool          // Do TLS verification.
}

Healthcheck represents a healthcheck that needs to be run against a Backend or Destination.

func NewHealthcheck

func NewHealthcheck(m seesaw.HealthcheckMode, t seesaw.HealthcheckType, port uint16) *Healthcheck

NewHealthcheck creates a new, initialised Healthcheck structure.

func (*Healthcheck) Key

func (h *Healthcheck) Key() string

Key returns the unique identifier for a Healthcheck.

type Healthchecks

type Healthchecks []*Healthcheck

Healthchecks is a list of Healthchecks.

func (Healthchecks) Len

func (h Healthchecks) Len() int

func (Healthchecks) Less

func (h Healthchecks) Less(i, j int) bool

func (Healthchecks) Swap

func (h Healthchecks) Swap(i, j int)

type Notification

type Notification struct {
	Cluster      *Cluster
	MetadataOnly bool

	Source       Source
	SourceDetail string
	Time         time.Time
	// contains filtered or unexported fields
}

Notification represents a configuration change notification.

func ConfigFromServer

func ConfigFromServer(cluster string) (*Notification, error)

ConfigFromServer fetches the cluster configuration for the given cluster.

func ReadConfig

func ReadConfig(filename, clusterName string) (*Notification, error)

ReadConfig reads a cluster configuration file.

func (*Notification) String

func (n *Notification) String() string

type Notifier

type Notifier struct {
	// Immutable fields.
	C <-chan Notification
	// contains filtered or unexported fields
}

Notifier monitors cluster configuration sources and sends Notifications via C on configuration changes.

func NewNotifier

func NewNotifier(ec *EngineConfig) (*Notifier, error)

NewNotifier creates a new Notifier.

func (*Notifier) Reload

func (n *Notifier) Reload() error

Reload requests an immediate reload from the configuration source.

func (*Notifier) SetSource

func (n *Notifier) SetSource(source Source)

SetSource sets the configuration Source for a Notifier.

func (*Notifier) Shutdown

func (n *Notifier) Shutdown()

Shutdown shuts down a Notifier.

func (*Notifier) Source

func (n *Notifier) Source() Source

Source returns the current configuration source.

type Source

type Source int

Source specifies a source of configuration information.

const (
	SourceNone Source = iota
	SourceDisk
	SourcePeer
	SourceServer
)

func SourceByName

func SourceByName(name string) (Source, error)

SourceByName returns the source that has the given name.

func (Source) String

func (s Source) String() string

String returns the string representation of a source.

type Vserver

type Vserver struct {
	Name string
	seesaw.Host
	Entries      map[string]*VserverEntry   // by VserverEntry.Key()
	Backends     map[string]*seesaw.Backend // by Backend.Key()
	Healthchecks map[string]*Healthcheck    // by Healthcheck.Key()
	VIPs         map[string]*seesaw.VIP     // by VIP.IP.String()
	Enabled      bool
	UseFWM       bool
	Warnings     []string
}

Vserver represents the configuration for a virtual server.

func NewVserver

func NewVserver(name string, host seesaw.Host) *Vserver

NewVserver creates a new, initialised Vserver structure.

func (*Vserver) AddBackend

func (v *Vserver) AddBackend(backend *seesaw.Backend) error

AddBackend adds a Backend to a Vserver.

func (*Vserver) AddHealthcheck

func (v *Vserver) AddHealthcheck(h *Healthcheck) error

AddHealthcheck adds a Healthcheck to a Vserver.

func (*Vserver) AddVIP

func (v *Vserver) AddVIP(vip *seesaw.VIP) error

AddVIP adds a VIP to a Vserver.

func (*Vserver) AddVserverEntry

func (v *Vserver) AddVserverEntry(e *VserverEntry) error

AddVserverEntry adds an VserverEntry to a Vserver.

func (*Vserver) Key

func (v *Vserver) Key() string

Key returns the unique identifier for a Vserver.

type VserverEntry

type VserverEntry struct {
	Port          uint16
	Proto         seesaw.IPProto
	Scheduler     seesaw.LBScheduler
	Mode          seesaw.LBMode
	Persistence   int
	OnePacket     bool
	HighWatermark float32
	LowWatermark  float32
	LThreshold    int
	UThreshold    int
	Healthchecks  map[string]*Healthcheck // by Healthcheck.Key()
}

VserverEntry specifies the configuration for a port and protocol combination for a Vserver.

func NewVserverEntry

func NewVserverEntry(port uint16, proto seesaw.IPProto) *VserverEntry

NewVserverEntry creates a new, initialised VserverEntry structure.

func (*VserverEntry) AddHealthcheck

func (v *VserverEntry) AddHealthcheck(h *Healthcheck) error

AddHealthcheck adds a Healthcheck to a VserverEntry.

func (*VserverEntry) Key

func (v *VserverEntry) Key() string

Key returns the unique identifier for a VserverEntry.

func (*VserverEntry) Snapshot

func (v *VserverEntry) Snapshot() *seesaw.VserverEntry

Snapshot returns a snapshot for a VserverEntry.

Jump to

Keyboard shortcuts

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