1 unstable release
0.1.0 | Nov 7, 2024 |
---|
#1435 in Network programming
119 downloads per month
Used in 2 crates
190KB
4K
SLoC
junction-api
The common API for junction clients and control plane.
lib.rs
:
The Junction configuration API. This crate allows you to build configuration for a dynamic HTTP client and export it to a control plane or pass it directly to an in-process client. Junction configuration is expressable as plain Rust strucs, and can be serialized/deserialized with a [serde] compatible library.
All of the configuration here should be correct by construction - if you can create a struct, it's valid Junction configuration. Different representations of the same configuration are possible, and clients and control planes may normalize your configuration differently, so when writing tests for your configuration be aware that it may be normalized while converting between different formats or data sources.
Core Concepts
Targets
The Junction API is built around the idea of a traffic [Target], a a unique identifier for a place to send traffic. Targets are logical; a Kubernetes Service target represents the entire service, running anywhere in a multi-cluster deployment, not an individual Pod or Node or Service object.
Routes
An HTTP Route is the client facing half of Junction, and contains most of the things you'd traditionally find in a hand-rolled HTTP client - timeouts, retries, URL rewriting and more. The [http] module's documentation goes into detail on how and why to configure a Route.
Backends
A Backend is the Service oriented half of Junction configuration. Backends configuration gives you control over the things you'd normally configure in a reverse proxy or a traditional load balancer, like load balancing. See the [backend] module's documentation for more detail.
Crate Feature Flags
The following feature flags are available:
-
The
kube
feature includes conversions from Junction configuration to and from Kubernetes objects. This feature depends on thekube
andk8s-openapi
crates. See the [kube] module docs for more detail. -
The
xds
feature includes conversions from Junction configuration to and from xDS types. This feature depends on the [xds-api][xds_api] crate.
Dependencies
~3–22MB
~309K SLoC