controller

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2015 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package controller contains the router controller.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HostForRoute added in v1.0.6

func HostForRoute(route *routeapi.Route) string

HostForRoute returns the host set on the route.

Types

type HostToRouteMap added in v1.0.6

type HostToRouteMap map[string][]*routeapi.Route

type NamespaceLister added in v1.0.6

type NamespaceLister interface {
	NamespaceNames() (sets.String, error)
}

NamespaceLister returns all the names that should be watched by the client

type RouteHostFunc added in v1.0.6

type RouteHostFunc func(*routeapi.Route) string

RouteHostFunc returns a host for a route. It may return an empty string.

type RouteToHostMap added in v1.0.6

type RouteToHostMap map[string]string

type RouterController

type RouterController struct {
	Plugin        router.Plugin
	NextRoute     func() (watch.EventType, *routeapi.Route, error)
	NextEndpoints func() (watch.EventType, *kapi.Endpoints, error)

	Namespaces            NamespaceLister
	NamespaceSyncInterval time.Duration
	NamespaceWaitInterval time.Duration
	NamespaceRetries      int
	// contains filtered or unexported fields
}

RouterController abstracts the details of watching the Route and Endpoints resources from the Plugin implementation being used.

func (*RouterController) HandleEndpoints

func (c *RouterController) HandleEndpoints()

HandleEndpoints handles a single Endpoints event and refreshes the router backend.

func (*RouterController) HandleNamespaces added in v1.0.6

func (c *RouterController) HandleNamespaces()

func (*RouterController) HandleRoute

func (c *RouterController) HandleRoute()

HandleRoute handles a single Route event and synchronizes the router backend.

func (*RouterController) Run

func (c *RouterController) Run()

Run begins watching and syncing.

type UniqueHost added in v1.0.6

type UniqueHost struct {
	// contains filtered or unexported fields
}

UniqueHost implements the router.Plugin interface to provide a template based, backend-agnostic router.

func NewUniqueHost added in v1.0.6

func NewUniqueHost(plugin router.Plugin, fn RouteHostFunc) *UniqueHost

NewUniqueHost creates a plugin wrapper that ensures only unique routes are passed into the underlying plugin.

func (*UniqueHost) HandleEndpoints added in v1.0.6

func (p *UniqueHost) HandleEndpoints(eventType watch.EventType, endpoints *kapi.Endpoints) error

HandleEndpoints processes watch events on the Endpoints resource.

func (*UniqueHost) HandleNamespaces added in v1.0.6

func (p *UniqueHost) HandleNamespaces(namespaces sets.String) error

HandleAllowedNamespaces limits the scope of valid routes to only those that match the provided namespace list.

func (*UniqueHost) HandleRoute added in v1.0.6

func (p *UniqueHost) HandleRoute(eventType watch.EventType, route *routeapi.Route) error

HandleRoute processes watch events on the Route resource. TODO: this function can probably be collapsed with the router itself, as a function that

determines which component needs to be recalculated (which template) and then does so
on demand.

func (*UniqueHost) HostLen added in v1.0.6

func (p *UniqueHost) HostLen() int

HostLen returns the number of hosts currently tracked by this plugin.

func (*UniqueHost) RoutesForHost added in v1.0.6

func (p *UniqueHost) RoutesForHost(host string) ([]*routeapi.Route, bool)

RoutesForHost is a helper that allows routes to be retrieved.

Source Files

  • controller.go
  • doc.go
  • unique_host.go

Directories

Path Synopsis
Package factory contains code used to create the router controller.
Package factory contains code used to create the router controller.

Jump to

Keyboard shortcuts

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