Documentation ¶
Index ¶
- func Clone(src proto.Message) proto.Message
- func Decode(name string) (proto.Message, error)
- func GetAmbassadorDrainTime() time.Duration
- func JoinEdsClusters(ctx context.Context, clusters []ctypes.Resource, ...) (endpoints []ctypes.Resource)
- func ListenerToRdsListener(lnr *api.Listener) (*api.Listener, []*api.RouteConfiguration, error)
- func Main(ctx context.Context, Version string, rawArgs ...string) error
- func Main2(ctx context.Context, Version string, getUsage MemoryGetter, ...) error
- func Merge(to, from proto.Message)
- func Updater(ctx context.Context, updates <-chan Update, getUsage MemoryGetter) error
- type Args
- type Endpoint
- type Endpoints
- type Hasher
- type MemoryGetter
- type Update
- type Validatable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAmbassadorDrainTime ¶ added in v1.9.0
The GetAmbassadorDrainTime function retuns the AMBASSADOR_DRAIN_TIME env var as a time.Duration
func JoinEdsClusters ¶ added in v1.12.0
func JoinEdsClusters(ctx context.Context, clusters []ctypes.Resource, edsEndpoints map[string]*v2.ClusterLoadAssignment) (endpoints []ctypes.Resource)
JoinEdsClusters will perform an outer join operation between the eds clusters in the supplied clusterlist and the eds endpoint data in the supplied map. It will return a slice of ClusterLoadAssignments (cast to []ctypes.Resource) with endpoint data for all the eds clusters in the supplied list. If there is no map entry for a given cluster, an empty ClusterLoadAssignment will be synthesized. The result is a set of endpoints that are consistent (by the go-control-plane's definition of consistent) with the input clusters.
func ListenerToRdsListener ¶ added in v1.11.0
ListenerToRdsListener will take a listener definition and extract any inline RouteConfigurations replacing them with a reference to an RDS supplied route configuration. It does not modify the supplied listener, any configuration included in the result is copied from the input.
If the input listener does not match the expected form it is simply copied, i.e. it is the identity transform for any inputs not matching the expected form.
Example Input (that will get transformed in a non-identity way):
a listener configured with an http connection manager
that specifies an http router
that supplies its RouteConfiguration inline via the route_config field
{ "name": "...", ..., "filter_chains": [ { "filter_chain_match": {...}, "filters": [ { "name": "envoy.filters.network.http_connection_manager", "typed_config": { "@type": "type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager", "http_filters": [...], "route_config": { "virtual_hosts": [ { "name": "ambassador-listener-8443-*", "domains": ["*"], "routes": [...], } ] } } } ] } ] }
Example Output:
a duplicate listener that defines the "rds" field instead of the "route_config" field
and a list of route configurations
with route_config_name supplied in such a way as to correlate the two together
lnr, routes, err := ListenerToRdsListener(...)
lnr = { "name": "...", ..., "filter_chains": [ { "filter_chain_match": {...}, "filters": [ { "name": "envoy.filters.network.http_connection_manager", "typed_config": { "@type": "type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager", "http_filters": [...], "rds": { "config_source": { "ads": {} }, "route_config_name": "ambassador-listener-8443-routeconfig-0" } } } ] } ] }
routes = [ { "name": "ambassador-listener-8443-routeconfig-0", "virtual_hosts": [ { "name": "ambassador-listener-8443-*", "domains": ["*"], "routes": [...], } ] } ]
func Updater ¶ added in v1.9.0
func Updater(ctx context.Context, updates <-chan Update, getUsage MemoryGetter) error
The Updator function will run forever (or until the ctx is canceled) and look for updates on the incoming channel. If memory usage is constrained as reported by the getUsage function, updates will be rate limited to guarantee that there are only so many stale configs in memory at a time. The function assumes updates are cumulative and it will drop old queued updates if a new update arrives.
Types ¶
type Endpoint ¶ added in v1.12.0
Endpoint contains the subset of fields we bother to expose.
func (*Endpoint) ToLbEndpoint_v2 ¶ added in v1.12.0
func (e *Endpoint) ToLbEndpoint_v2() *v2endpoint.LbEndpoint
ToLBEndpoint_v2 translates to envoy v2 frinedly form of the Endpoint data.
type Endpoints ¶ added in v1.12.0
The Endpoints struct is how Endpoint data gets communicated to ambex. This is a bit simpler than the envoy endpoint data structures, and also provides us a layer of indirection to buffer us from changes in envoy configuration, e.g. we can switch from v2 to v3 endpoint data, or add v3 endpoint data fairly easily with this layer of indirection.
func (*Endpoints) RoutesString ¶ added in v1.12.0
type MemoryGetter ¶ added in v1.9.0
type MemoryGetter func() int
Function type for fetching memory usage as a percentage.
type Update ¶ added in v1.9.0
An Update encapsulates everything needed to perform an update (of envoy configuration). The version string is for logging purposes, the Updator func does the actual work of updating.
type Validatable ¶
Not sure if there is a better way to do this, but we cast to this so we can call the generated Validate method.