An embeddable, dynamically configurable HTTP library
Project description
junction-client
An embeddable, dynamically configurable HTTP library.
About
Junction is a library that allows you to dynamically configure application level HTTP routing, load balancing, and resilience by writing a few lines of configuration and dynamically pushing it to your client. Imagine having all of the features of a rich HTTP proxy that's as easy to work with as the HTTP library you're already using.
Junction can be statically configured, with plain old software, or dynamically configured with any gRPC-xDS compatible configuration server. Check out ezbake for a simple server that lets you save Junction config using the Kubernetes Gateway API
Project status
Junction is alpha software, developed in the open. We're still iterating rapidly on core code and APIs. At this stage you should expect occasional breaking changes as the library evolves. At the moment, Junction only supports talking to Kubernetes services, with support for routing to any existing DNS name coming very soon.
Features
Junction allows you to statically or dynamically configure:
- Routing traffic to backends based on the HTTP method, path, headers, or query parameters.
- Timeouts
- Retries
- Weighted traffic splitting
- Load balancing
Junction differs from existing libraries and proxies in that we aim to do all of this in your native programming language, with low overhead and deep integration into your existing HTTP client. This approach means that Junction can provide dynamic config, but still provide first class support for things like unit testing and debugging, putting developers back in control of their applications.
Roadmap
We're starting small and focused with Junction. Our first goal is getting configuration right. Our next goal is allowing you to push configuration that you've developed and tested to a centralized config server.
Supported Languages and HTTP Libraries
| Language | Core Library | Supported HTTP Libraries |
|---|---|---|
| Rust | junction-core |
None |
| Python | junction |
requests and urllib3 |
Using a Junction client
Junction clients are part of your application and function as a cache for dynamic configuration. All Junction clients can also be configured with static configuration that acts as a default when a server doesn't have any dynamic configuration for a route or a target. When you make an HTTP request, Junction matches it against existing configuration, decides where and how to send the request, and then hands back control to your HTTP library.
In all of our libraries, Junction clients expect to be able to talk to a dynamic configuration server. The details of how you specify which config server to talk to are specific to each language - we want it to feel natural.
If you don't already have a gRPC-compatible xDS server available, try installing ezbake in your local Kubernetes cluster.
Python
In Python, Junction is available as a standalone client and as a drop-in replacement
for requests.Session or urllib3.PoolManager.
Using junction as a drop-in replacement for requests is as easy as:
import junction.requests as requests
session = requests.Session()
resp = session.get("http://my-service.prod.svc.cluster.local")
To configure your client, pass default_routes or default_backends to your
Session. For example, to load-balance requests to an nginx service in the
web namespace based on the x-user header, you can specify:
import junction.requests as requests
# create a new Session with a default load balancing policy for the nginx service
session = requests.Session(
default_backends=[
{
"target": {"type": "service", "name": "nginx", "namespace": "web"},
"lb": {
"type": "RingHash",
"hash_params": [
{"type": "Header", "name": "x-user"},
],
},
}
]
)
# make a request to the nginx service
session.get("http://nginx.web.svc.cluster.local")
Routes can be configured by default as well. To send all requests to /v2/users to a different
version of your application, you could set a default configuration like:
import junction.config
import typing
import junction.requests as requests
my_service = {"type": "service", "name": "cool", "namespace": "widgets"}
my_test_service = {"type": "service", "name": "cooler", "namespace": "widgets"}
# create a new routing policy.
#
# all Junction config comes with python3 type hints, as long as you import junction.config
routes: typing.List[junction.config.Route] = [
{
"target": my_service,
"rules": [
{
"backends": [my_test_service],
"matches": [{"path": {"value": "/v2/users"}}],
},
{
"backends": [my_service],
"retry": retry_policy,
"timeouts": timeouts,
},
],
},
]
# assert that requests with no path go to the cool service like normal
(_, _, matched_backend) = junction.check_route(
routes, "GET", "http://cool.widgets.svc.cluster.local", {}
)
assert matched_backend["name"] == "cool"
# assert that requests to /v2/users go to an even cooler service
(_, _, matched_backend) = junction.check_route(
routes, "GET", "http://cool.widgets.svc.cluster.local/v2/users", {}
)
assert matched_backend["name"] == "cooler"
# use the routes we just tested in our HTTP client
s = requests.Session(default_routes=routes)
For a more complete example configuration see the sample project. It's a runnable example containing routing tables, load balancing, retry policies, and more.
NodeJS
NodeJS support is coming soon! Please reach out to info@junctionlabs.io if you run NodeJS services and are interested in being an early access design partner.
Rust
The core of Junction is written in Rust and is available in the
junction-core
crate. At the moment, we don't have an integration with an HTTP library
available, but you can use the core client to dynamically fetch config and
resolve addresses.
See the examples directory for an
example
of how to use junction to resolve an address.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file junction_python-0.1.0.tar.gz.
File metadata
- Download URL: junction_python-0.1.0.tar.gz
- Upload date:
- Size: 151.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab052112fb4c638d874720a2bd8f6dfde3f50fb3f0ee9400d2e364ef20265a9d
|
|
| MD5 |
d274187d5ae9fb398fbdd34c3f651891
|
|
| BLAKE2b-256 |
6a61b6e2a874407b2023745767158ec0ed0a96a4e3e8c86fc73db489966b9d31
|
Provenance
The following attestation bundles were made for junction_python-0.1.0.tar.gz:
Publisher:
release-python.yaml on junction-labs/junction-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
junction_python-0.1.0.tar.gz -
Subject digest:
ab052112fb4c638d874720a2bd8f6dfde3f50fb3f0ee9400d2e364ef20265a9d - Sigstore transparency entry: 147377675
- Sigstore integration time:
-
Permalink:
junction-labs/junction-client@1d84a7e1fe3db52f250ceafbfcc847c005972b80 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/junction-labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yaml@1d84a7e1fe3db52f250ceafbfcc847c005972b80 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file junction_python-0.1.0-cp38-abi3-win_amd64.whl.
File metadata
- Download URL: junction_python-0.1.0-cp38-abi3-win_amd64.whl
- Upload date:
- Size: 4.0 MB
- Tags: CPython 3.8+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
039b5fc4626264a60365d00b35e7401722c4f6287d748025ec76132bb4a087d8
|
|
| MD5 |
94d6aedad6383679ca4d90d6265b13a5
|
|
| BLAKE2b-256 |
7794074df326593d3f206f530cefeb35cb0a05fd82ef9b49861327b97581947d
|
Provenance
The following attestation bundles were made for junction_python-0.1.0-cp38-abi3-win_amd64.whl:
Publisher:
release-python.yaml on junction-labs/junction-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
junction_python-0.1.0-cp38-abi3-win_amd64.whl -
Subject digest:
039b5fc4626264a60365d00b35e7401722c4f6287d748025ec76132bb4a087d8 - Sigstore transparency entry: 147377680
- Sigstore integration time:
-
Permalink:
junction-labs/junction-client@1d84a7e1fe3db52f250ceafbfcc847c005972b80 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/junction-labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yaml@1d84a7e1fe3db52f250ceafbfcc847c005972b80 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file junction_python-0.1.0-cp38-abi3-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: junction_python-0.1.0-cp38-abi3-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 5.0 MB
- Tags: CPython 3.8+, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c3ce33e6ed5ed3a9507b2e250bdf239c128efd5f4d09261e692b0b0a396944d
|
|
| MD5 |
cf2d013bf918d9e6ba70f2fd48a33350
|
|
| BLAKE2b-256 |
d307351e3b40e4a7dacc76c5a0a3040da1f34a38f5e7901b781e29432590c67a
|
Provenance
The following attestation bundles were made for junction_python-0.1.0-cp38-abi3-musllinux_1_2_x86_64.whl:
Publisher:
release-python.yaml on junction-labs/junction-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
junction_python-0.1.0-cp38-abi3-musllinux_1_2_x86_64.whl -
Subject digest:
1c3ce33e6ed5ed3a9507b2e250bdf239c128efd5f4d09261e692b0b0a396944d - Sigstore transparency entry: 147377684
- Sigstore integration time:
-
Permalink:
junction-labs/junction-client@1d84a7e1fe3db52f250ceafbfcc847c005972b80 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/junction-labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yaml@1d84a7e1fe3db52f250ceafbfcc847c005972b80 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file junction_python-0.1.0-cp38-abi3-musllinux_1_2_aarch64.whl.
File metadata
- Download URL: junction_python-0.1.0-cp38-abi3-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 5.0 MB
- Tags: CPython 3.8+, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0bba7e2d5659ea8b46236964471bf1749e0334bea8873423e33fc9d9c00026ee
|
|
| MD5 |
71b738009bfd8feff348ed42cf6bb852
|
|
| BLAKE2b-256 |
784943efd09ad58e351d0edd328a4437777ff25e001cc468b765c2a5f09e0ea8
|
Provenance
The following attestation bundles were made for junction_python-0.1.0-cp38-abi3-musllinux_1_2_aarch64.whl:
Publisher:
release-python.yaml on junction-labs/junction-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
junction_python-0.1.0-cp38-abi3-musllinux_1_2_aarch64.whl -
Subject digest:
0bba7e2d5659ea8b46236964471bf1749e0334bea8873423e33fc9d9c00026ee - Sigstore transparency entry: 147377679
- Sigstore integration time:
-
Permalink:
junction-labs/junction-client@1d84a7e1fe3db52f250ceafbfcc847c005972b80 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/junction-labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yaml@1d84a7e1fe3db52f250ceafbfcc847c005972b80 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file junction_python-0.1.0-cp38-abi3-manylinux_2_24_aarch64.whl.
File metadata
- Download URL: junction_python-0.1.0-cp38-abi3-manylinux_2_24_aarch64.whl
- Upload date:
- Size: 4.8 MB
- Tags: CPython 3.8+, manylinux: glibc 2.24+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07db91cc780e40135327b75589dafb16dd3aceaa54f41b3c3a67ef7e388a2aba
|
|
| MD5 |
3fb2a1ef1708cb1507232e522ed95288
|
|
| BLAKE2b-256 |
efcb2ebffa5950e739290f8a18f53c8489ee39c860f33c0d04ef6c2f1ed81adc
|
Provenance
The following attestation bundles were made for junction_python-0.1.0-cp38-abi3-manylinux_2_24_aarch64.whl:
Publisher:
release-python.yaml on junction-labs/junction-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
junction_python-0.1.0-cp38-abi3-manylinux_2_24_aarch64.whl -
Subject digest:
07db91cc780e40135327b75589dafb16dd3aceaa54f41b3c3a67ef7e388a2aba - Sigstore transparency entry: 147377682
- Sigstore integration time:
-
Permalink:
junction-labs/junction-client@1d84a7e1fe3db52f250ceafbfcc847c005972b80 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/junction-labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yaml@1d84a7e1fe3db52f250ceafbfcc847c005972b80 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file junction_python-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: junction_python-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 4.9 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61557841400343a42291ba822f63503270663141379dd79fac47c84aa8ebbe61
|
|
| MD5 |
fff597795311e825c3eb7e6e69af29b3
|
|
| BLAKE2b-256 |
f429580fa6dad64ace6a79a5e21fa079446bd3032b13da47de47cc98978f4ac4
|
Provenance
The following attestation bundles were made for junction_python-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release-python.yaml on junction-labs/junction-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
junction_python-0.1.0-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl -
Subject digest:
61557841400343a42291ba822f63503270663141379dd79fac47c84aa8ebbe61 - Sigstore transparency entry: 147377681
- Sigstore integration time:
-
Permalink:
junction-labs/junction-client@1d84a7e1fe3db52f250ceafbfcc847c005972b80 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/junction-labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yaml@1d84a7e1fe3db52f250ceafbfcc847c005972b80 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file junction_python-0.1.0-cp38-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: junction_python-0.1.0-cp38-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 4.3 MB
- Tags: CPython 3.8+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a57602e98d775d64a28318a56f173f1448741eb7ace23434172bd6b62e7d307
|
|
| MD5 |
d4cb93a2fe6a02c72bd87679e242f4ed
|
|
| BLAKE2b-256 |
8655634a25d27448314fe904352f80fb8683f71d1a80419698354fe2e7ae73c0
|
Provenance
The following attestation bundles were made for junction_python-0.1.0-cp38-abi3-macosx_11_0_arm64.whl:
Publisher:
release-python.yaml on junction-labs/junction-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
junction_python-0.1.0-cp38-abi3-macosx_11_0_arm64.whl -
Subject digest:
1a57602e98d775d64a28318a56f173f1448741eb7ace23434172bd6b62e7d307 - Sigstore transparency entry: 147377677
- Sigstore integration time:
-
Permalink:
junction-labs/junction-client@1d84a7e1fe3db52f250ceafbfcc847c005972b80 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/junction-labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yaml@1d84a7e1fe3db52f250ceafbfcc847c005972b80 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file junction_python-0.1.0-cp38-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: junction_python-0.1.0-cp38-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 4.5 MB
- Tags: CPython 3.8+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa386186d4a9ddf60db80045b4fab6403d979053aaefcad059c20bf2c643a5ad
|
|
| MD5 |
4eec74d01a9aaa140c8fe87cae4545d9
|
|
| BLAKE2b-256 |
6abc0ef7930c4fb508dd3badbb4d11a645d06f85ec5f25fed51334dc5c6d754c
|
Provenance
The following attestation bundles were made for junction_python-0.1.0-cp38-abi3-macosx_10_12_x86_64.whl:
Publisher:
release-python.yaml on junction-labs/junction-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
junction_python-0.1.0-cp38-abi3-macosx_10_12_x86_64.whl -
Subject digest:
fa386186d4a9ddf60db80045b4fab6403d979053aaefcad059c20bf2c643a5ad - Sigstore transparency entry: 147377678
- Sigstore integration time:
-
Permalink:
junction-labs/junction-client@1d84a7e1fe3db52f250ceafbfcc847c005972b80 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/junction-labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yaml@1d84a7e1fe3db52f250ceafbfcc847c005972b80 -
Trigger Event:
workflow_dispatch
-
Statement type: