Skip to content

Commit

Permalink
Document inlet-uplink upstream domains
Browse files Browse the repository at this point in the history
Add documentation on how to  expose multiple HTTP services through a
single tunnel and invoke them without having to set the Host header
in each request.

Signed-off-by: Han Verstraete (OpenFaaS Ltd) <[email protected]>
  • Loading branch information
welteki authored and alexellis committed Dec 8, 2023
1 parent aa240ae commit 665f02b
Showing 1 changed file with 31 additions and 5 deletions.
36 changes: 31 additions & 5 deletions docs/uplink/create-tunnels.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,15 +236,41 @@ Content-Length: 973
The following example shows how to access more than one HTTP service over the same tunnel. It is possible to expose multiple upstream services over a single tunnel.
You can add upstreamDomains to the Tunnel resource. Uplink wil create additional Services for each domain so the HTTP data plane is available on different domains.
```diff
apiVersion: uplink.inlets.dev/v1alpha1
kind: Tunnel
metadata:
name: acmeco
namespace: tunnels
spec:
licenseRef:
name: inlets-uplink-license
namespace: tunnels
tcpPorts:
- 8080
+ upstreamDomains:
+ - gateway
+ - prometheus
```
Upstreams can also be added while creating a tunnel with with cli:
```bash
inlets-pro tunnel create acmeco \
--namespace tunnels \
--upstream gateway \
--upstream prometheus
```
Start a tunnel client and add multiple upstreams:
```bash
inlets-pro uplink client \
--url wss://uplink.example.com/tunnels/acmeco \
--upstream prometheus=http://127.0.0.1:9090 \
--upstream gateway=http://127.0.0.1:8080 \
--upstream prometheus.tunnels=http://127.0.0.1:9090 \
--upstream gateway.tunnels=http://127.0.0.1:8080 \
--token-file ./token.txt
```
Access both services using `curl`:
Expand All @@ -253,7 +279,7 @@ Access both services using `curl`:
$ kubectl run -t -i curl --rm \
--image ghcr.io/openfaas/curl:latest /bin/sh
$ curl -i -H "Host: prometheus" acmeco.tunnels:8000
$ curl -i gateway.tunnels:8000
HTTP/1.1 302 Found
Content-Length: 29
Content-Type: text/html; charset=utf-8
Expand All @@ -263,7 +289,7 @@ Location: /graph
<a href="/graph">Found</a>.
$ curl -i -H "Host: gateway" acmeco.tunnels:8000
$ curl -i -H prometheus.tunnels:8000
HTTP/1.1 301 Moved Permanently
Content-Length: 39
Content-Type: text/html; charset=utf-8
Expand Down

0 comments on commit 665f02b

Please sign in to comment.