Documentation ¶
Index ¶
- Variables
- func RegisterPrometheusExporter(ctx *Context)
- type BackendInfo
- type BackendOptions
- type Context
- func (ctx *Context) Close()
- func (ctx *Context) CreateBackend(vsID, rsID string, opts *BackendOptions) error
- func (ctx *Context) CreateService(vsID string, opts *ServiceOptions) error
- func (ctx *Context) GetBackend(vsID, rsID string) (*BackendInfo, error)
- func (ctx *Context) GetService(vsID string) (*ServiceInfo, error)
- func (ctx *Context) ListServices() ([]string, error)
- func (ctx *Context) RemoveBackend(vsID, rsID string) (*BackendOptions, error)
- func (ctx *Context) RemoveService(vsID string) (*ServiceOptions, error)
- func (ctx *Context) SetStore(store *Store)
- func (ctx *Context) Synchronize(storeServices map[string]*ServiceOptions, ...)
- func (ctx *Context) UpdateBackend(vsID, rsID string, weight int32) (int32, error)
- type ContextOptions
- type Exporter
- type Ipvs
- type ServiceInfo
- type ServiceOptions
- type Store
- func (s *Store) Close()
- func (s *Store) CreateBackend(vsID, rsID string, opts *BackendOptions) error
- func (s *Store) CreateService(vsID string, opts *ServiceOptions) error
- func (s *Store) RemoveBackend(rsID string) error
- func (s *Store) RemoveService(vsID string) error
- func (s *Store) Sync()
- func (s *Store) UpdateBackend(vsID, rsID string, opts *BackendOptions) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrIpvsSyscallFailed = errors.New("error while calling into IPVS") ErrObjectExists = errors.New("specified object already exists") ErrObjectNotFound = errors.New("unable to locate specified object") ErrIncompatibleAFs = errors.New("incompatible address families") )
Possible runtime errors.
var ( ErrMissingEndpoint = errors.New("endpoint information is missing") ErrUnknownMethod = errors.New("specified forwarding method is unknown") ErrUnknownProtocol = errors.New("specified protocol is unknown") ErrUnknownFlag = errors.New("specified flag is unknown") )
Possible validation errors.
Functions ¶
func RegisterPrometheusExporter ¶
func RegisterPrometheusExporter(ctx *Context)
Types ¶
type BackendInfo ¶
type BackendInfo struct { Options *BackendOptions `json:"options"` Metrics pulse.Metrics `json:"metrics"` }
BackendInfo contains information about backend options and pulse.
type BackendOptions ¶
type BackendOptions struct { Host string `json:"host"` Port uint16 `json:"port"` Weight int32 `json:"weight"` Method string `json:"method"` Pulse *pulse.Options `json:"pulse"` VsID string `json:"vsid,omitempty"` // contains filtered or unexported fields }
BackendOptions describe a virtual service backend.
func (*BackendOptions) CompareStoreOptions ¶
func (o *BackendOptions) CompareStoreOptions(options *BackendOptions) bool
func (*BackendOptions) Validate ¶
func (o *BackendOptions) Validate() error
Validate fills missing fields and validates backend configuration.
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context abstacts away the underlying IPVS bindings implementation.
func NewContext ¶
func NewContext(options ContextOptions) (*Context, error)
NewContext creates a new Context and initializes IPVS.
func (*Context) CreateBackend ¶
func (ctx *Context) CreateBackend(vsID, rsID string, opts *BackendOptions) error
CreateBackend registers a new backend with a virtual service.
func (*Context) CreateService ¶
func (ctx *Context) CreateService(vsID string, opts *ServiceOptions) error
CreateService registers a new virtual service with IPVS.
func (*Context) GetBackend ¶
func (ctx *Context) GetBackend(vsID, rsID string) (*BackendInfo, error)
GetBackend returns information about a backend.
func (*Context) GetService ¶
func (ctx *Context) GetService(vsID string) (*ServiceInfo, error)
GetService returns information about a virtual service.
func (*Context) ListServices ¶
ListServices returns a list of all registered services.
func (*Context) RemoveBackend ¶
func (ctx *Context) RemoveBackend(vsID, rsID string) (*BackendOptions, error)
RemoveBackend deregisters a backend.
func (*Context) RemoveService ¶
func (ctx *Context) RemoveService(vsID string) (*ServiceOptions, error)
RemoveService deregisters a virtual service.
func (*Context) Synchronize ¶
func (ctx *Context) Synchronize(storeServices map[string]*ServiceOptions, storeBackends map[string]*BackendOptions)
type ContextOptions ¶
type ContextOptions struct { Disco string Endpoints []net.IP Flush bool ListenPort uint16 VipInterface string }
ContextOptions configure Context behavior.
type Exporter ¶
type Exporter struct {
// contains filtered or unexported fields
}
func NewExporter ¶
func (*Exporter) Collect ¶
func (e *Exporter) Collect(ch chan<- prometheus.Metric)
func (*Exporter) Describe ¶
func (e *Exporter) Describe(ch chan<- *prometheus.Desc)
type Ipvs ¶
type Ipvs interface { Init() error Exit() Flush() error AddService(vip string, port uint16, protocol uint16, sched string) error AddServiceWithFlags(vip string, port uint16, protocol uint16, sched string, flags []byte) error DelService(vip string, port uint16, protocol uint16) error AddDestPort(vip string, vport uint16, rip string, rport uint16, protocol uint16, weight int32, fwd uint32) error UpdateDestPort(vip string, vport uint16, rip string, rport uint16, protocol uint16, weight int32, fwd uint32) error DelDestPort(vip string, vport uint16, rip string, rport uint16, protocol uint16) error }
type ServiceInfo ¶
type ServiceInfo struct { Options *ServiceOptions `json:"options"` Health float64 `json:"health"` Backends []string `json:"backends"` }
ServiceInfo contains information about virtual service options, its backends and overall virtual service health.
type ServiceOptions ¶
type ServiceOptions struct { Host string `json:"host"` Port uint16 `json:"port"` Protocol string `json:"protocol"` Method string `json:"method"` Flags string `json:"flags"` Persistent bool `json:"persistent"` // contains filtered or unexported fields }
ServiceOptions describe a virtual service.
func (*ServiceOptions) CompareStoreOptions ¶
func (o *ServiceOptions) CompareStoreOptions(options *ServiceOptions) bool
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) CreateBackend ¶
func (s *Store) CreateBackend(vsID, rsID string, opts *BackendOptions) error
func (*Store) CreateService ¶
func (s *Store) CreateService(vsID string, opts *ServiceOptions) error
func (*Store) RemoveBackend ¶
func (*Store) RemoveService ¶
func (*Store) UpdateBackend ¶
func (s *Store) UpdateBackend(vsID, rsID string, opts *BackendOptions) error