Documentation
¶
Overview ¶
Package controller contains the router controller.
Index ¶
- Variables
- func HostForRoute(route *routeapi.Route) string
- type ExtendedValidator
- type HostToRouteMap
- type NamespaceLister
- type RejectionRecorder
- type RouteHostFunc
- type RouteToHostMap
- type RouterController
- type StatusAdmitter
- func (a *StatusAdmitter) HandleEndpoints(eventType watch.EventType, route *kapi.Endpoints) error
- func (a *StatusAdmitter) HandleNamespaces(namespaces sets.String) error
- func (a *StatusAdmitter) HandleRoute(eventType watch.EventType, route *routeapi.Route) error
- func (a *StatusAdmitter) RecordRouteRejection(route *routeapi.Route, reason, message string)
- type UniqueHost
- func (p *UniqueHost) HandleEndpoints(eventType watch.EventType, endpoints *kapi.Endpoints) error
- func (p *UniqueHost) HandleNamespaces(namespaces sets.String) error
- func (p *UniqueHost) HandleRoute(eventType watch.EventType, route *routeapi.Route) error
- func (p *UniqueHost) HostLen() int
- func (p *UniqueHost) RoutesForHost(host string) ([]*routeapi.Route, bool)
Constants ¶
This section is empty.
Variables ¶
var LogRejections = logRecorder{}
Functions ¶
func HostForRoute ¶
HostForRoute returns the host set on the route.
Types ¶
type ExtendedValidator ¶
type ExtendedValidator struct {
// contains filtered or unexported fields
}
ExtendedValidator implements the router.Plugin interface to provide extended config validation for template based, backend-agnostic routers.
func NewExtendedValidator ¶
func NewExtendedValidator(plugin router.Plugin, recorder RejectionRecorder) *ExtendedValidator
ExtendedValidator creates a plugin wrapper that ensures only routes that pass extended validation are relayed to the next plugin in the chain. Recorder is an interface for indicating why a route was rejected.
func (*ExtendedValidator) HandleEndpoints ¶
func (p *ExtendedValidator) HandleEndpoints(eventType watch.EventType, endpoints *kapi.Endpoints) error
HandleEndpoints processes watch events on the Endpoints resource.
func (*ExtendedValidator) HandleNamespaces ¶
func (p *ExtendedValidator) HandleNamespaces(namespaces sets.String) error
HandleAllowedNamespaces limits the scope of valid routes to only those that match the provided namespace list.
func (*ExtendedValidator) HandleRoute ¶
HandleRoute processes watch events on the Route resource.
type HostToRouteMap ¶
type NamespaceLister ¶
NamespaceLister returns all the names that should be watched by the client
type RejectionRecorder ¶
type RejectionRecorder interface {
RecordRouteRejection(route *routeapi.Route, reason, message string)
}
RejectionRecorder is an object capable of recording why a route was rejected
type RouteHostFunc ¶
RouteHostFunc returns a host for a route. It may return an empty string.
type RouteToHostMap ¶
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 ¶
func (c *RouterController) HandleNamespaces()
func (*RouterController) HandleRoute ¶
func (c *RouterController) HandleRoute()
HandleRoute handles a single Route event and synchronizes the router backend.
type StatusAdmitter ¶
type StatusAdmitter struct {
// contains filtered or unexported fields
}
StatusAdmitter ensures routes added to the plugin have status set.
func NewStatusAdmitter ¶
func NewStatusAdmitter(plugin router.Plugin, client client.RoutesNamespacer, name string) *StatusAdmitter
NewStatusAdmitter creates a plugin wrapper that ensures every accepted route has a status field set that matches this router. The admitter manages an LRU of recently seen conflicting updates to handle when two router processes with differing configurations are writing updates at the same time.
func (*StatusAdmitter) HandleEndpoints ¶
func (*StatusAdmitter) HandleNamespaces ¶
func (a *StatusAdmitter) HandleNamespaces(namespaces sets.String) error
func (*StatusAdmitter) HandleRoute ¶
HandleRoute attempts to admit the provided route on watch add / modifications.
func (*StatusAdmitter) RecordRouteRejection ¶
func (a *StatusAdmitter) RecordRouteRejection(route *routeapi.Route, reason, message string)
RecordRouteRejection attempts to update the route status with a reason for a route being rejected.
type UniqueHost ¶
type UniqueHost struct {
// contains filtered or unexported fields
}
UniqueHost implements the router.Plugin interface to provide a template based, backend-agnostic router.
func NewUniqueHost ¶
func NewUniqueHost(plugin router.Plugin, fn RouteHostFunc, recorder RejectionRecorder) *UniqueHost
NewUniqueHost creates a plugin wrapper that ensures only unique routes are passed into the underlying plugin. Recorder is an interface for indicating why a route was rejected.
func (*UniqueHost) HandleEndpoints ¶
HandleEndpoints processes watch events on the Endpoints resource.
func (*UniqueHost) HandleNamespaces ¶
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 ¶
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 ¶
func (p *UniqueHost) HostLen() int
HostLen returns the number of hosts currently tracked by this plugin.
func (*UniqueHost) RoutesForHost ¶
func (p *UniqueHost) RoutesForHost(host string) ([]*routeapi.Route, bool)
RoutesForHost is a helper that allows routes to be retrieved.