services

package
v0.0.0-...-e2c1c9c Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const MaximumAge = time.Duration(1 * time.Hour)

Variables

This section is empty.

Functions

func Go

func Go(ctx context.Context) (err error)

Go starts the service manager, which monitors etcd, writes configurations, and updates haproxy, as necessary

func Load

func Load() (changed bool, err error)

Load reads all the services from etcd

func Reload

func Reload() (err error)

Reload tells haproxy to reload its configuration

func Update

func Update() error

Update regenerates the list of services and, if there were changes, writes the new configuration and reloads haproxy

func Watch

func Watch(ctx context.Context)

Watch watches all relevent etcd keys and updates the services on change

func Write

func Write() (err error)

Write writes the necessary files

func WriteCerts

func WriteCerts() (err error)

WriteCerts writes each certificate in the service list to a file

func WriteConfig

func WriteConfig() (err error)

Write the haproxy config file

Types

type Backend

type Backend struct {
	Name     string    // Name/Value of the backend
	LastSeen time.Time // Timestamp of last visibility
}

A Backend represents a service provider within the cluster

func (*Backend) Equals

func (b *Backend) Equals(n *Backend) bool

Equals determines if two backends are equivalent

type Backends

type Backends []Backend

Backends represents a set of backends

func (Backends) Equals

func (b Backends) Equals(n Backends) bool

Equals determines if two backend lists are equivalent

func (Backends) Expire

func (b Backends) Expire() Backends

Expire returns a list of backends whose ages are less than MaximumAge

func (Backends) Merge

func (b Backends) Merge(n Backends) *Backends

Merge combines two lists of backends, taking the newer entries

type HAProxyConfig

type HAProxyConfig struct {
	IPv4     string
	IPv6     string
	Services map[string]*Service
}

type Service

type Service struct {
	Name     string   // Service Name
	DNS      []string // DNS hostnames for service
	Cert     string   // Certificates (PEM) for service
	Backends Backends // List of active backends for the service
}

Service represents a discrete service in the proxy

func ParseServiceNode

func ParseServiceNode(n *client.Node) (*Service, error)

ParseServiceNode reads in a service node and returns a *Service for it

func (*Service) CertFile

func (s *Service) CertFile() string

func (*Service) Equals

func (s *Service) Equals(n *Service) bool

Equals determines if two services are equivalent

Jump to

Keyboard shortcuts

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