Config#
Junction client configuration.
Classes:
A Backend is a logical target for network traffic. |
|
A target and port together uniquely represent a [Backend][crate::backend::Backend]. |
|
A fraction, expressed as a numerator and a denominator. |
|
A Route is a policy that describes how a request to a specific virtual host should be routed. |
|
Defines the predicate used to match requests to a given action. |
|
Configure client retry policy. |
|
A RouteRule contains a set of matches that define which requests it applies to, processing rules, and the final destination(s) for matching traffic. |
|
Defines timeouts that can be configured for a HTTP Route. |
|
A virtual hostname. |
|
The combination of a backend and a weight. |
- class junction.config.Backend[source]#
A Backend is a logical target for network traffic.
A backend configures how all traffic for it’s
target
is handled. Any traffic routed to this backend will use its load balancing policy to evenly spread traffic across all available endpoints.Attributes:
A unique description of what this backend is.
How traffic to this target should be load balanced.
- lb: LbPolicyRoundRobin | LbPolicyRingHash | LbPolicyUnspecified#
How traffic to this target should be load balanced.
- class junction.config.BackendId[source]#
A target and port together uniquely represent a [Backend][crate::backend::Backend].
Attributes:
A valid RFC1123 DNS domain name.
The name of the Kubernetes Service to target.
The namespace of the Kubernetes service to target.
The port backend traffic is sent on.
- junction.config.Duration = str | int | float#
A duration expressed as a total number of seconds. Durations should never be negative.
- class junction.config.HeaderValue[source]#
Attributes:
- name: str#
The name of the HTTP Header. Note header names are case insensitive. (See <https://tools.ietf.org/html/rfc7230#section-3.2>).
- class junction.config.LbPolicyRingHash[source]#
Attributes:
How to hash an outgoing request into the ring.
The minimum size of the hash ring
- hash_params: List[SessionAffinityHashParam]#
How to hash an outgoing request into the ring.
Hash parameters are applied in order. If the request is missing an input, it has no effect on the final hash. Hashing stops when only when all polices have been applied or a
terminal
policy matches part of an incoming request.This allows configuring a fallback-style hash, where the value of
HeaderA
gets used, falling back to the value ofHeaderB
.If no policies match, a random hash is generated for each request.
- class junction.config.Route[source]#
A Route is a policy that describes how a request to a specific virtual host should be routed.
Attributes:
The rules that determine whether a request matches and where traffic should be routed.
A list of arbitrary tags that can be added to a Route.
A virtual hostname that uniquely identifies this route.
- rules: List[RouteRule]#
The rules that determine whether a request matches and where traffic should be routed.
- vhost: VirtualHost#
A virtual hostname that uniquely identifies this route.
- class junction.config.RouteMatch[source]#
Defines the predicate used to match requests to a given action. Multiple match types are ANDed together; the match will evaluate to true only if all conditions are satisfied. For example, if a match specifies a
path
match and twoquery_params
matches, it will match only if the request’s path matches and both of thequery_params
are matches.The default RouteMatch functions like a path match on the empty prefix, which matches every request.
Attributes:
Specifies HTTP request header matchers.
Specifies HTTP method matcher.
Specifies a HTTP request path matcher.
Specifies HTTP query parameter matchers.
- headers: List[HeaderMatchRegularExpression | HeaderMatchExact]#
Specifies HTTP request header matchers. Multiple match values are ANDed together, meaning, a request must match all the specified headers.
- method: str#
Specifies HTTP method matcher. When specified, this route will be matched only if the request has the specified method.
- path: PathMatchPrefix | PathMatchRegularExpression | PathMatchExact#
Specifies a HTTP request path matcher.
- query_params: List[QueryParamMatchRegularExpression | QueryParamMatchExact]#
Specifies HTTP query parameter matchers. Multiple match values are ANDed together, meaning, a request must match all the specified query parameters.
- class junction.config.RouteRetry[source]#
Configure client retry policy.
Attributes:
The total number of attempts to make when retrying this request.
The amount of time to back off between requests during a series of retries.
The HTTP error codes that retries should be applied to.
- class junction.config.RouteRule[source]#
A RouteRule contains a set of matches that define which requests it applies to, processing rules, and the final destination(s) for matching traffic.
See the Junction docs for a high level description of how Routes and RouteRules behave.
Attributes:
Where the traffic should route if this rule matches.
A list of match rules applied to an outgoing request.
How to retry requests.
- backends: List[WeightedBackend]#
Where the traffic should route if this rule matches.
If no backends are specified, traffic is sent to the VirtualHost this route was defined with, using the request’s port to fill in any defaults.
- matches: List[RouteMatch]#
A list of match rules applied to an outgoing request. Each match is independent; this rule will be matched if any of the listed matches is satsified.
If no matches are specified, this Rule matches any outgoing request.
- retry: RouteRetry#
How to retry requests. If not specified, requests are not retried.
- class junction.config.RouteTimeouts[source]#
Defines timeouts that can be configured for a HTTP Route.
Attributes:
Specifies a timeout for an individual request to a backend.
Specifies the maximum duration for a HTTP request.
- backend_request: str | int | float#
Specifies a timeout for an individual request to a backend. This covers the time from when the request first starts being sent to when the full response has been received from the backend.
Because the overall request timeout encompasses the backend request timeout, the value of this timeout must be less than or equal to the value of the overall timeout.
- request: str | int | float#
Specifies the maximum duration for a HTTP request. This timeout is intended to cover as close to the whole request-response transaction as possible.
An entire client HTTP transaction may result in more than one call to destination backends, for example, if automatic retries are configured.
- class junction.config.SessionAffinityHashParam[source]#
Attributes:
The name of the header to use as hash input.
Whether to stop immediately after hashing this value.
- class junction.config.TargetKubeService[source]#
Attributes:
The name of the Kubernetes Service to target.
The namespace of the Kubernetes service to target.
- class junction.config.VirtualHost[source]#
A virtual hostname.
VirtualHosts
represent the primary layer of indirection in Junction. Traffic sent to aVirtualHost
is routed to an appropriate backend based on the content of the request.VirtualHosts uniquely map to the Authority section of a URL.
Attributes:
A valid RFC1123 DNS domain name.
The name of the Kubernetes Service to target.
The namespace of the Kubernetes service to target.
The port this virtual hostname should apply to.
- class junction.config.WeightedBackend[source]#
The combination of a backend and a weight.
Attributes:
A valid RFC1123 DNS domain name.
The name of the Kubernetes Service to target.
The namespace of the Kubernetes service to target.
The port backend traffic is sent on.
The relative weight of this backend relative to any other backends in [the list][RouteRule::backends].