Reverse Proxy Configuration
Dynamic routing configuration in the Hydrolix cluster spec config results in updates to Traefik's configuration. This configuration will be updated with any new dynamic routing paths using headers or query parameters.
Dynamic routing uses Traefik rules and priority to determine which ingest pool should handle an incoming request. Note that dynamic ingestion rules are only executed on requests that arrive at the default pool (/ingest/event). Incoming requests to any non-default pool (/pool/{pool_name}/ingest/event) are handled exclusively by that pool.
Traefik matchers⚓︎
The Hydrolix operator dynamically reconfigures the traefik matchers according to instructions in the cluster spec file.
The following matchers are used:
PathPrefix- explicit routing to a specific pool, always present for each defined poolHeader- exact string match on HTTP header and valueQuery- exact string match on query parameter and valueHeaderRegexp- regular expression match on a value in a specific HTTP headerQueryRegexp- regular expression match on a value in a specific query parameter
Verify Traefik config updates⚓︎
If you haven't already, install K9s.
If an existing pool called intake-head-private-pool is updated with the following routing configuration:
You can confirm the Traefik configuration has been updated using the following steps.
- Start k9s from a shell:
k9s. - Open up the pods selector by entering:
:pods. - Select the Traefik pod and shell into the
traefikcontainer using the commands. -
Run the following command:
After a few minutes of latency at most, you will observe the following changes:
Rules and priority⚓︎
Rules and priority within a Hydrolix cluster therefore respect the following descending order of precedence:
- Explicit pool endpoint, PathPrefix(
/pool/pool-name): Which endpoint the request arrives at, if the endpoint is a non-default ingest endpoint. For example, requests arriving athttps://hostname.hydrolix.live/pool/{pool_name}/ingest/eventwill be handled by the ingest pool called{pool_name}regardless of the headers or query parameters included. - Default ingestion endpoint and query parameters, PathPrefix(
/ingest) and Query Parameters (Query(key, value)): For example, a request sent tohttps://hostname.hydrolix.live/ingest/event?table=my_table&transform=my_transformand the headerx-hdx-myheader: secondary_poolwith the following cluster configuration:
=== "Configuration example: Pools demonstrating query parameter routing for one pool and header routing for another"
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | |
would be handled by custom-ingest-pool rather than secondary-pool.
- Default ingestion endpoint and HTTP headers, PathPrefix(
/ingest) and HTTP Headers (Header(key, value)): For example, a request sent tohttps://hostname.hydrolix.live/ingest/eventwith headersX-Hdx-Table: my_tableandX-Hdx-Transform: my_transformwith the following cluster configuration:
=== "Configuration example: Pool demonstrating header routing"
1 2 3 4 5 6 7 8 9 10 11 | |
would be handled by the custom-ingest-pool ingest pool.
Overlapping rules⚓︎
Multiple rules can match an incoming request's header and query parameter configuration.
In this case, Traefik determines which ingest pool will handle the request using a rules length priority calculation.
For example, given the following configuration:
This generates the Traefik rules:
A request coming sent to https://hostname.hydrolix.live/ingest/event?table=my_table&transform=my_transform matches both rules. The longer rule has priority, so the long-rule-pool processes the incoming request.