types

package
v0.0.0-...-a355528 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2017 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultSyncInterval is the interval between syncing backends
	DefaultSyncInterval = 5 * time.Second
)

Variables

This section is empty.

Functions

func RegisterRouteHandler

func RegisterRouteHandler(key string, f func() (RouteHandler, error))

RegisterRouteHandler registers a package specific handler for determining the L4 routes (e.g. static or swarm)

func ResolveDependencies

func ResolveDependencies(spec types.Spec) (depends.Runnables, error)

ResolveDependencies returns a list of dependencies by parsing the opaque Properties blob.

func TemplateFrom

func TemplateFrom(source []byte) (*template.Template, error)

TemplateFrom returns a template after it has un-escapes any escape sequences

Types

type BackendSpec

type BackendSpec struct {

	// Groups are the ids of the groups managed by the group controller.
	// The plugin name is used ==> plugin name and type. type is the group id.
	Groups []Group

	// Instances are static instance ids
	Instances []instance.ID
}

BackendSpec specifies the instances that are the backends. They can come from groups of a given group controller or speccific instance ids.

type Group

type Group plugin.Name

Group is a qualified plugin name. The 'type' field of the name is the group ID.

func (Group) ID

func (gs Group) ID() group.ID

ID returns the group id.

func (Group) Plugin

func (gs Group) Plugin() plugin.Name

Plugin returns the plugin to contact

type Options

type Options struct {

	// HardSync when set to true will remove entries already in the L4 that
	// may have been added by the user out of band.  Default is false.
	HardSync bool

	// MatchByLabels figures out services by looking at swarm service labels.
	// This is normally OFF and instead we just look at publish and target ports.
	MatchByLabels bool

	// SyncInterval is how often to run the sync. The syntax is the string form
	// of Go time.Duration (e.g. 1min)
	SyncInterval types.Duration

	// SourceKeySelector is a string template for selecting the join key from
	// a source instance.Description.
	SourceKeySelector string
}

Options is the controller options

type Properties

type Properties []Spec

Properties is the properties for the ingress controller. This struct is used to parse the `Properties` field of a pkg/types/Spec.

func (Properties) Groups

func (p Properties) Groups() (result map[Vhost][]Group, err error)

Groups returns a list of group ids by Vhost

func (Properties) HealthChecks

func (p Properties) HealthChecks() (result map[Vhost][]loadbalancer.HealthCheck, err error)

HealthChecks returns a map of health checks by vhost

func (Properties) InstanceIDs

func (p Properties) InstanceIDs() (result map[Vhost][]instance.ID, err error)

InstanceIDs returns a map of static instance ids by vhost

func (Properties) L4Func

func (p Properties) L4Func(findL4 func(spec Spec) (loadbalancer.L4, error)) func() (map[Vhost]loadbalancer.L4, error)

L4Func returns a function that can return a map of vhost and L4 objects, with the help of plugin lookup.

func (Properties) Routes

func (p Properties) Routes(options Options) (result map[Vhost][]loadbalancer.Route, err error)

Routes returns a map of routes by vhost. This will try to parse the Routes field of each Spec as loadbalancer.Route. If parsing fails, the provided function callback is used to provide alternative parsing of the types.Any to give the data.

type RouteHandler

type RouteHandler interface {
	io.Closer
	// Routes returns a map of vhost and loadbalancer routes given the input blob
	Routes(*types.Any, Options) (map[Vhost][]loadbalancer.Route, error)
}

RouteHandler is the interface that different modules must support

type Spec

type Spec struct {

	// Vhost is the Vhost for the load balancer
	Vhost Vhost

	// L4Plugin is the name of the L4Plugin to lookup
	L4Plugin plugin.Name

	// RouteSources allows the specification of routes based on some specialized handlers.
	// The routes are keyed by the 'handler' name and the configuration blob are specific to the keyed
	// handler.  For example, a 'swarm' handler will dynamically generate the required routes based
	// on Docker swarm services.  These routes are added to the static routes.
	RouteSources map[string]*types.Any

	// Routes are those that are always synchronized routes that are specified in the configuration.
	Routes []loadbalancer.Route

	// Backends specify where to get the nodes of the backend pool.
	Backends BackendSpec

	// HealthChecks specify how to do health check against the backend services
	HealthChecks []loadbalancer.HealthCheck
}

Spec provides a mapping of a vhost to

type Vhost

type Vhost string

Vhost is the virtual host / domain

Jump to

Keyboard shortcuts

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