Documentation ¶
Index ¶
- Constants
- Variables
- func AmISwarmLeader(ctx context.Context, client client.APIClient) (bool, error)
- func RoutesFromSwarmServices() (ingress.RouteHandler, error)
- type Docker
- type Routes
- type RoutesBuilder
- func (b *RoutesBuilder) AddRule(n string, m ServiceMatcher, ...) *RoutesBuilder
- func (b *RoutesBuilder) Build() (*Routes, error)
- func (b *RoutesBuilder) SetHardSyncWithLB(t bool) *RoutesBuilder
- func (b *RoutesBuilder) SetOptions(options ingress.Options) *RoutesBuilder
- func (b *RoutesBuilder) SetSpecLabels(lbSpec, certSpec string) *RoutesBuilder
- type ServiceMatcher
- type Spec
Constants ¶
const ( // HostNotSpecified is a constant that indicates no host information is provided // so a route / listener derived from this Swarm service should apply to any (or all) loadbalancers. HostNotSpecified = "" )
const ( // LabelExternalLoadBalancerSpec is the label for marking a service as public facing. // The value is a url. The protocol, host and port will be extracted from the URL // to configure the external load balancer. The ELB will be configured to listen // at the specified port (or 80), using the specified protocol, and the host is used to // select which load balancer in the config file on the manager nodes /var/lib/docker/editions/lb.config // TODO(chungers) - While the hostname is used to select the ELB to use, we will also provide support // for HTTP/S vhosts in the future if the hostname is not matched to an ELB, we will select a top level ELB // and then use the subdomain in the hostname to configure a HAProxy with http header routing. LabelExternalLoadBalancerSpec = "docker.swarm.lb" )
Variables ¶
Functions ¶
func AmISwarmLeader ¶
AmISwarmLeader determines if the current node is the swarm manager leader
func RoutesFromSwarmServices ¶
func RoutesFromSwarmServices() (ingress.RouteHandler, error)
RoutesFromSwarmServices determines the routes based on the services running in the Docker swarm
Types ¶
type Routes ¶
type Routes struct {
// contains filtered or unexported fields
}
Routes can derive a list of routes based on Docker services
func (*Routes) List ¶
List will return all the known routes for this Docker swarm of matching services.
func (*Routes) RoutesFromServices ¶
func (p *Routes) RoutesFromServices(services []swarm.Service) (map[ingress.Vhost][]loadbalancer.Route, error)
RoutesFromServices analyzes the given set of services and option and produces a routes by vhost.
type RoutesBuilder ¶
type RoutesBuilder struct {
// contains filtered or unexported fields
}
RoutesBuilder simplifies creation of a routes.
func NewServiceRoutes ¶
func NewServiceRoutes(client docker.APIClientCloser) *RoutesBuilder
NewServiceRoutes creates a routes.
func (*RoutesBuilder) AddRule ¶
func (b *RoutesBuilder) AddRule(n string, m ServiceMatcher, toRoutes func([]swarm.Service) (map[ingress.Vhost][]loadbalancer.Route, error)) *RoutesBuilder
AddRule adds a rule to aggregate the routes for
func (*RoutesBuilder) Build ¶
func (b *RoutesBuilder) Build() (*Routes, error)
Build creates the routes.
func (*RoutesBuilder) SetHardSyncWithLB ¶
func (b *RoutesBuilder) SetHardSyncWithLB(t bool) *RoutesBuilder
SetHardSyncWithLB forces the routes to do a hard sync for every service. This is not very efficient when there are lots of services.
func (*RoutesBuilder) SetOptions ¶
func (b *RoutesBuilder) SetOptions(options ingress.Options) *RoutesBuilder
SetOptions sets the ingress options
func (*RoutesBuilder) SetSpecLabels ¶
func (b *RoutesBuilder) SetSpecLabels(lbSpec, certSpec string) *RoutesBuilder
SetSpecLabels sets the label to look for for loadbalancer spec and certifcate spec
type ServiceMatcher ¶
ServiceMatcher is a swarm.Service predicate.
func MatchSpecLabels ¶
func MatchSpecLabels(kv map[string]string) ServiceMatcher
MatchSpecLabels returns a matcher that matches the labels as given map. This is an OR / ANY match