Junction#

class junction.Junction(**kwargs)#

A Junction endpoint discovery client.

Methods:

dump_backends()

Dump the client's backend config.

dump_routes()

Dump the client's current route config.

dump_xds()

Dump the client's current xDS config as a pbjson dict.

resolve_http(method, url, headers)

Resolve an endpoint based on an HTTP method, url, and headers.

resolve_route(method, url, headers[, dynamic])

Perform the route resolution half of resolve_http, returning the matched route, the index of the matching rule, and the backend that was selected.

run_csds_server(port)

Spawn a new CSDS server on the given port.

dump_backends()#

Dump the client’s backend config.

This is the same merged view of dynamic config and static config that the client uses to make load balancing decisions.

dump_routes()#

Dump the client’s current route config.

This is the same merged view of dynamic config and static config that the client uses to make routing decisions.

dump_xds()#

Dump the client’s current xDS config as a pbjson dict.

The xDS config will contain the latest values for all resources and any errors encountered while trying to fetch updated versions.

resolve_http(method, url, headers)#

Resolve an endpoint based on an HTTP method, url, and headers.

Returns the list of endpoints that traffic should be directed to, taking in to account load balancing and any prior requests. A request should be sent to all endpoints, and it’s up to the caller to decide how to combine multiple responses.

resolve_route(method, url, headers, dynamic=True)#

Perform the route resolution half of resolve_http, returning the matched route, the index of the matching rule, and the backend that was selected. Use it as a lower level method to debug route resolution, or to look up Routes without making a full request.

If dynamic=False is passed as a kwarg, the resolution happens without fetching any new routing data over the network.

run_csds_server(port)#

Spawn a new CSDS server on the given port. Spawning the server will not block the current thread.