Documentation ¶
Overview ¶
Package controller contains the router controller.
Index ¶
- Variables
- func HostForRoute(route *routeapi.Route) string
- type ExtendedValidator
- func (p *ExtendedValidator) Commit() error
- func (p *ExtendedValidator) HandleEndpoints(eventType watch.EventType, endpoints *kapi.Endpoints) error
- func (p *ExtendedValidator) HandleNamespaces(namespaces sets.String) error
- func (p *ExtendedValidator) HandleNode(eventType watch.EventType, node *kapi.Node) error
- func (p *ExtendedValidator) HandleRoute(eventType watch.EventType, route *routeapi.Route) error
- type HostAdmitter
- func (p *HostAdmitter) Commit() error
- func (p *HostAdmitter) HandleEndpoints(eventType watch.EventType, endpoints *kapi.Endpoints) error
- func (p *HostAdmitter) HandleNamespaces(namespaces sets.String) error
- func (p *HostAdmitter) HandleNode(eventType watch.EventType, node *kapi.Node) error
- func (p *HostAdmitter) HandleRoute(eventType watch.EventType, route *routeapi.Route) error
- type HostToRouteMap
- type NamespaceLister
- type RejectionRecorder
- type RouteAdmissionFunc
- type RouteHostFunc
- type RouteMap
- type RouteToHostMap
- type RouterController
- type StatusAdmitter
- func (a *StatusAdmitter) Commit() error
- func (a *StatusAdmitter) HandleEndpoints(eventType watch.EventType, route *kapi.Endpoints) error
- func (a *StatusAdmitter) HandleNamespaces(namespaces sets.String) error
- func (a *StatusAdmitter) HandleNode(eventType watch.EventType, node *kapi.Node) 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) Commit() error
- func (p *UniqueHost) HandleEndpoints(eventType watch.EventType, endpoints *kapi.Endpoints) error
- func (p *UniqueHost) HandleNamespaces(namespaces sets.String) error
- func (p *UniqueHost) HandleNode(eventType watch.EventType, node *kapi.Node) 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 ¶ added in v1.0.6
HostForRoute returns the host set on the route.
Types ¶
type ExtendedValidator ¶ added in v1.3.0
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 ¶ added in v1.3.0
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) Commit ¶
func (p *ExtendedValidator) Commit() error
func (*ExtendedValidator) HandleEndpoints ¶ added in v1.3.0
func (p *ExtendedValidator) HandleEndpoints(eventType watch.EventType, endpoints *kapi.Endpoints) error
HandleEndpoints processes watch events on the Endpoints resource.
func (*ExtendedValidator) HandleNamespaces ¶ added in v1.3.0
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) HandleNode ¶ added in v1.4.0
HandleNode processes watch events on the node resource
func (*ExtendedValidator) HandleRoute ¶ added in v1.3.0
HandleRoute processes watch events on the Route resource.
type HostAdmitter ¶ added in v1.4.0
type HostAdmitter struct {
// contains filtered or unexported fields
}
HostAdmitter implements the router.Plugin interface to add admission control checks for routes in template based, backend-agnostic routers.
func NewHostAdmitter ¶ added in v1.4.0
func NewHostAdmitter(plugin router.Plugin, fn RouteAdmissionFunc, restrict bool, recorder RejectionRecorder) *HostAdmitter
NewHostAdmitter creates a plugin wrapper that checks whether or not to admit routes and relay them to the next plugin in the chain. Recorder is an interface for indicating why a route was rejected.
func (*HostAdmitter) Commit ¶
func (p *HostAdmitter) Commit() error
func (*HostAdmitter) HandleEndpoints ¶ added in v1.4.0
HandleEndpoints processes watch events on the Endpoints resource.
func (*HostAdmitter) HandleNamespaces ¶ added in v1.4.0
func (p *HostAdmitter) HandleNamespaces(namespaces sets.String) error
HandleAllowedNamespaces limits the scope of valid routes to only those that match the provided namespace list.
func (*HostAdmitter) HandleNode ¶ added in v1.4.0
HandleNode processes watch events on the Node resource.
func (*HostAdmitter) HandleRoute ¶ added in v1.4.0
HandleRoute processes watch events on the Route resource.
type HostToRouteMap ¶ added in v1.0.6
type NamespaceLister ¶ added in v1.0.6
NamespaceLister returns all the names that should be watched by the client
type RejectionRecorder ¶ added in v1.1.3
type RejectionRecorder interface {
RecordRouteRejection(route *routeapi.Route, reason, message string)
}
RejectionRecorder is an object capable of recording why a route was rejected
type RouteAdmissionFunc ¶ added in v1.4.0
RouteAdmissionFunc determines whether or not to admit a route.
type RouteHostFunc ¶ added in v1.0.6
RouteHostFunc returns a host for a route. It may return an empty string.
type RouteMap ¶ added in v1.4.0
RouteMap contains all routes associated with a key
func (RouteMap) InsertRoute ¶ added in v1.4.0
type RouteToHostMap ¶ added in v1.0.6
type RouterController ¶
type RouterController struct { Plugin router.Plugin NextRoute func() (watch.EventType, *routeapi.Route, error) NextNode func() (watch.EventType, *kapi.Node, error) NextEndpoints func() (watch.EventType, *kapi.Endpoints, error) RoutesListConsumed func() bool EndpointsListConsumed func() bool RoutesListSuccessfulAtLeastOnce func() bool EndpointsListSuccessfulAtLeastOnce func() bool RoutesListCount func() int EndpointsListCount func() int WatchNodes bool 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) HandleNode ¶ added in v1.4.0
func (c *RouterController) HandleNode()
HandleNode handles a single Node event and synchronizes the router backend
func (*RouterController) HandleRoute ¶
func (c *RouterController) HandleRoute()
HandleRoute handles a single Route event and synchronizes the router backend.
type StatusAdmitter ¶ added in v1.1.3
type StatusAdmitter struct {
// contains filtered or unexported fields
}
StatusAdmitter ensures routes added to the plugin have status set.
func NewStatusAdmitter ¶ added in v1.1.3
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) Commit ¶
func (a *StatusAdmitter) Commit() error
func (*StatusAdmitter) HandleEndpoints ¶ added in v1.1.3
func (*StatusAdmitter) HandleNamespaces ¶ added in v1.1.3
func (a *StatusAdmitter) HandleNamespaces(namespaces sets.String) error
func (*StatusAdmitter) HandleNode ¶ added in v1.4.0
func (*StatusAdmitter) HandleRoute ¶ added in v1.1.3
HandleRoute attempts to admit the provided route on watch add / modifications.
func (*StatusAdmitter) RecordRouteRejection ¶ added in v1.1.3
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 ¶ 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, 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) Commit ¶
func (p *UniqueHost) Commit() error
func (*UniqueHost) HandleEndpoints ¶ added in v1.0.6
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) HandleNode ¶ added in v1.4.0
HandleNode processes watch events on the Node resource and calls the router
func (*UniqueHost) HandleRoute ¶ added in v1.0.6
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.