Documentation ¶
Index ¶
- func Compile_HTTPHeaderMatch(headerMatch *gw.HTTPHeaderMatch) ([]*apiv2_route.HeaderMatcher, error)
- func Compile_HTTPRouteForwardTo(src Source, forward gw.HTTPRouteForwardTo, namespace string, ...) *apiv2_route.WeightedCluster_ClusterWeight
- func Compile_HTTPRouteMatch(match gw.HTTPRouteMatch) (*apiv2_route.RouteMatch, error)
- func Compile_HTTPRouteMatches(matches []gw.HTTPRouteMatch) ([]*apiv2_route.RouteMatch, error)
- func Compile_HTTPRouteRule(src Source, rule gw.HTTPRouteRule, namespace string, ...) ([]*apiv2_route.Route, error)
- type ClusterRef
- type CompiledCluster
- type CompiledConfig
- type CompiledItem
- type CompiledListener
- type CompiledLoadAssignment
- type CompiledRoute
- type Dispatcher
- func (d *Dispatcher) Delete(resource kates.Object)
- func (d *Dispatcher) DeleteKey(kind, namespace, name string)
- func (d *Dispatcher) GetErrors() []*CompiledItem
- func (d *Dispatcher) GetListener(ctx context.Context, name string) *apiv2.Listener
- func (d *Dispatcher) GetRouteConfiguration(ctx context.Context, name string) *apiv2.RouteConfiguration
- func (d *Dispatcher) GetSnapshot(ctx context.Context) (string, *ecp_v2_cache.Snapshot)
- func (d *Dispatcher) IsRegistered(kind string) bool
- func (d *Dispatcher) IsWatched(namespace, name string) bool
- func (d *Dispatcher) Register(kind string, transform func(kates.Object) (*CompiledConfig, error)) error
- func (d *Dispatcher) Upsert(resource kates.Object) error
- func (d *Dispatcher) UpsertYaml(manifests string) error
- type ResourceRef
- type Source
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Compile_HTTPHeaderMatch ¶
func Compile_HTTPHeaderMatch(headerMatch *gw.HTTPHeaderMatch) ([]*apiv2_route.HeaderMatcher, error)
func Compile_HTTPRouteForwardTo ¶
func Compile_HTTPRouteForwardTo(src Source, forward gw.HTTPRouteForwardTo, namespace string, clusterRefs *[]*ClusterRef) *apiv2_route.WeightedCluster_ClusterWeight
func Compile_HTTPRouteMatch ¶
func Compile_HTTPRouteMatch(match gw.HTTPRouteMatch) (*apiv2_route.RouteMatch, error)
func Compile_HTTPRouteMatches ¶
func Compile_HTTPRouteMatches(matches []gw.HTTPRouteMatch) ([]*apiv2_route.RouteMatch, error)
func Compile_HTTPRouteRule ¶
func Compile_HTTPRouteRule(src Source, rule gw.HTTPRouteRule, namespace string, clusterRefs *[]*ClusterRef) ([]*apiv2_route.Route, error)
Types ¶
type ClusterRef ¶
type ClusterRef struct { CompiledItem Name string // These are temporary fields to deal with how endpoints are currently plumbed from the watcher // through to ambex. EndpointPath string }
ClusterRef represents a reference to an envoy v2.Cluster.
type CompiledCluster ¶
type CompiledCluster struct { CompiledItem Cluster *v2.Cluster }
CompiledCluster decorates an envoy v2.Cluster.
type CompiledConfig ¶
type CompiledConfig struct { CompiledItem Listeners []*CompiledListener Routes []*CompiledRoute Clusters []*CompiledCluster LoadAssignments []*CompiledLoadAssignment }
CompiledConfig can hold any amount of any kind of envoy configuration fragments. All compile functions produce this type.
func Compile_Endpoints ¶
func Compile_Endpoints(endpoints *kates.Endpoints) (*CompiledConfig, error)
Compile_Endpoints transforms a kubernetes endpoints resource into a v2.ClusterLoadAssignment
func Compile_Gateway ¶
func Compile_Gateway(gateway *gw.Gateway) (*CompiledConfig, error)
func Compile_HTTPRoute ¶
func Compile_HTTPRoute(httpRoute *gw.HTTPRoute) (*CompiledConfig, error)
type CompiledItem ¶
type CompiledItem struct { Source Source // Tracks the source of truth for whatever produced this compiled item. Namespace string // The namespace of whatever produced this item. Error string // Holds any error associated with this compiled item. }
CompiledItem has fields common to all compilation units.
func NewCompiledItem ¶
func NewCompiledItem(source Source) CompiledItem
func NewCompiledItemError ¶
func NewCompiledItemError(source Source, error string) CompiledItem
type CompiledListener ¶
type CompiledListener struct { CompiledItem Listener *v2.Listener // The predicate determines which routes belong to which listeners. If the listener specifies // and Rds configuration, this Predicate and the Domains below will be used to construct a // RouteConfiguration from all the available CompiledRoutes. Predicate func(route *CompiledRoute) bool Domains []string }
CompiledListener is an envoy Listener plus a Predicate that the dispatcher uses to determine which routes to supply to the listener.
func Compile_Listener ¶
type CompiledLoadAssignment ¶
type CompiledLoadAssignment struct { CompiledItem LoadAssignment *v2.ClusterLoadAssignment }
CompiledLoadAssignment decorates an envoy v2.ClusterLoadAssignment.
type CompiledRoute ¶
type CompiledRoute struct { CompiledItem // This field will likely get replaced with something more astract, e.g. just info about the // source such as labels kind, namespace, name, etc. HTTPRoute *gw.HTTPRoute Routes []*route.Route ClusterRefs []*ClusterRef }
CompiledRoute is
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
The Dispatcher struct allows transforms to be registered for different kinds of kubernetes resources and invokes those transforms to produce compiled envoy configurations. It also knows how to assemble the compiled envoy configuration into a complete snapshot.
Currently the dispatch process is relatively simple, each resource is processed as an independent unit. This is sufficient for the gateway API since the currently implemented resources are conveniently defined in such a way as to make them independent.
Consistency is guaranteed assuming transform functions don't use out of band communication to include information from other resources. This guarantee is achieved because each transform is only passed a single resource and can therefore only use information from that one resource. Changes to any other resource cannot impact the result of that transform.
Not all the edgestack resources are defined as conveniently, so the Dispatcher design is expected to be extended in two ways to handle resources with more complex interdependencies:
Grouping -- This feature would cover resources that need to be processed as a group, e.g. Mappings that get grouped together based on prefix. Instead of dispatching at the granularity of a single resource, the dispatcher will track groups of resources that need to be processed together via a logical "hash" function provided at registration. Whenever any item in a given bucket changes, the dispatcher will transform the entire bucket.
Dependencies -- This feature would cover resources that need to lookup the contents of other resources in order to properly implement their transform. This would be done by passing the transform function a Query API. Any resources queried by the transform would be automatically tracked as a dependency of that resource. The dependencies would then be used to perform invalidation whenever a resource is Upsert()ed.
func NewDispatcher ¶
func NewDispatcher() *Dispatcher
NewDispatcher creates a new and empty *Dispatcher struct.
func (*Dispatcher) Delete ¶
func (d *Dispatcher) Delete(resource kates.Object)
Delete processes the deletion of the given kubernetes resource.
func (*Dispatcher) DeleteKey ¶
func (d *Dispatcher) DeleteKey(kind, namespace, name string)
func (*Dispatcher) GetErrors ¶
func (d *Dispatcher) GetErrors() []*CompiledItem
GetErrors returns all compiled items with errors.
func (*Dispatcher) GetListener ¶
GetListener returns a *apiv2.Listener with the specified name or nil if none exists.
func (*Dispatcher) GetRouteConfiguration ¶
func (d *Dispatcher) GetRouteConfiguration(ctx context.Context, name string) *apiv2.RouteConfiguration
GetRouteConfiguration returns a *apiv2.RouteConfiguration with the specified name or nil if none exists.
func (*Dispatcher) GetSnapshot ¶
func (d *Dispatcher) GetSnapshot(ctx context.Context) (string, *ecp_v2_cache.Snapshot)
GetSnapshot returns a version and a snapshot.
func (*Dispatcher) IsRegistered ¶
func (d *Dispatcher) IsRegistered(kind string) bool
IsRegistered returns true if the given kind can be processed by this dispatcher.
func (*Dispatcher) IsWatched ¶
func (d *Dispatcher) IsWatched(namespace, name string) bool
IsWatched is a temporary hack for dealing with the way endpoint data currenttly flows from watcher -> ambex.n
func (*Dispatcher) Register ¶
func (d *Dispatcher) Register(kind string, transform func(kates.Object) (*CompiledConfig, error)) error
Register registers a transform function for the specified kubernetes resource. The transform argument must be a function that takes a single resource of the supplied "kind" and returns a single CompiledConfig object, i.e.: `func(Kind) *CompiledConfig`
func (*Dispatcher) Upsert ¶
func (d *Dispatcher) Upsert(resource kates.Object) error
Upsert processes the given kubernetes resource whether it is new or just updated.
func (*Dispatcher) UpsertYaml ¶
func (d *Dispatcher) UpsertYaml(manifests string) error
UpsertYaml parses the supplied yaml and invokes Upsert on the result.