Skip to content

Commit 469157b

Browse files
weltekialexellis
authored andcommitted
Move REST API setup instructions to installation page
Move installation and configuration details for the REST API from rest-api.md to installation.md so the API reference page serves strictly as an endpoint reference. - Add 'Setup the REST API' section to installation.md with access token, ingress, and OAuth configuration instructions - Update rest-api.md to cross-reference the installation page - Update configuration table to reflect clientApi.enabled defaults to true - Update API docs to reflect auto generated access token Signed-off-by: Han Verstraete (OpenFaaS Ltd) <han@openfaas.com>
1 parent 7991c13 commit 469157b

File tree

2 files changed

+77
-81
lines changed

2 files changed

+77
-81
lines changed

docs/uplink/installation.md

Lines changed: 75 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,77 @@ NAME READY SECRET AGE
249249
client-router-cert True client-router-cert 30m
250250
```
251251
252+
## Setup the REST API
253+
254+
The REST API for Uplink is enabled by default and accessible on the same domain as the client-router under the `/v1` path prefix. For example, if your client-router domain is `uplink.example.com`, the API will be available at `https://uplink.example.com/v1`.
255+
256+
See the [REST API reference](/uplink/rest-api/) to learn how to invoke the API and for a full list of endpoints.
257+
258+
Optionally, the client-api can be exposed on a [separate domain](#configure-a-separate-api-domain).
259+
260+
### Access token
261+
262+
An access token is generated by Helm and stored as a Kubernetes secret during installation. This token can be used to authenticate with the API.
263+
264+
If you need to create the token manually, for example to use a specific value, you can do so before installing the chart:
265+
266+
```sh
267+
# Generate a new access token
268+
export token=$(openssl rand -base64 32|tr -d '\n')
269+
echo -n $token > $HOME/.inlets/client-api
270+
271+
# Store the access token in a secret in the inlets namespace.
272+
kubectl create secret generic \
273+
client-api-token \
274+
-n inlets \
275+
--from-file client-api-token=$HOME/.inlets/client-api
276+
```
277+
278+
If the secret already exists, Helm will use the existing token instead of generating a new one.
279+
280+
> See the [OAuth configuration](#configure-oauth) section for instructions on how to enable OAuth.
281+
282+
### Configure OAuth
283+
284+
You can configure any OpenID Connect (OIDC) compatible identity provider for use with Inlets Uplink.
285+
286+
1. Register a new client (application) for Inlets Uplink with your identity provider.
287+
2. Enable the required authentication flows.
288+
The Client Credentials flow is ideal for serve-to-server interactions where there is no direct user involvement. This is the flow we recommend and use in our examples any other authentication flow can be picked depending on your use case.
289+
3. Configure Client API
290+
291+
Update your `values.yaml` file and add the following parameters to the `clientApi` section:
292+
293+
```yaml
294+
clientApi:
295+
# OIDC provider url.
296+
issuerURL: "https://myprovider.example.com"
297+
298+
# The audience is generally the same as the value of the domain field, however
299+
# some issuers like keycloak make the audience the client_id of the application/client.
300+
audience: "uplink.example.com"
301+
```
302+
303+
The `issuerURL` needs to be set to the url of your provider, eg. `https://accounts.google.com` for google or `https://example.eu.auth0.com/` for Auth0.
304+
305+
The `audience` is usually the client apis public URL although for some providers it can also be the client id.
306+
307+
### Configure a separate API domain
308+
309+
By default, the client-api is exposed on the same domain as the client-router under the `/v1` path prefix. If you prefer to use a separate domain, set the `clientApi.domain` field in your `values.yaml` file and enable the dedicated ingress:
310+
311+
```yaml
312+
clientApi:
313+
# Use a dedicated domain for the client API
314+
domain: clientapi.example.com
315+
316+
tls:
317+
ingress:
318+
enabled: true
319+
```
320+
321+
When a dedicated domain is set and `clientApi.tls.ingress.enabled` is `true`, a separate Ingress resource is created for the client-api.
322+
252323
## Download the tunnel CLI
253324
254325
We provide a CLI to help you create and manage tunnels. It is available as a plugin for the inlets-pro CLI.
@@ -334,8 +405,10 @@ Overview of inlets-uplink parameters in `values.yaml`.
334405
| `clientRouter.service.nodePort` | Client router service port for NodePort service type, assigned automatically when left empty. (only if clientRouter.service.type is set to "NodePort")| `nil` |
335406
| `tunnelsNamespace` | Deployments, Services and Secrets will be created in this namespace. Leave blank for a cluster-wide scope, with tunnels in multiple namespaces. | `""` |
336407
| `inletsVersion` | Inlets Pro release version for tunnel server Pods. | `0.9.12` |
337-
| `clientApi.enabled` | Enable tunnel management REST API. | `false` |
338-
| `clientApi.domain` | Domain for a dedicated client API ingress. If left empty and ingress is enabled, the API is exposed on the client-router's domain under the `/v1` path prefix. | `""` |
408+
| `clientApi.enabled` | Enable tunnel management REST API. | `true` |
409+
| `clientApi.domain` | Domain for a dedicated client API ingress. By default the API is exposed on the client-router's domain under the `/v1` path prefix. | `""` |
410+
| `clientApi.tls.ingress.enabled` | Enable a dedicated ingress for the client API. Requires `clientApi.domain` to be set. | `false` |
411+
| `clientApi.tls.ingress.annotations` | Annotations to be added to the client API ingress resource. | `{}` |
339412
| `clientApi.image` | Container image used for the client API. | `ghcr.io/openfaasltd/uplink-api:0.1.5` |
340413
| `prometheus.create` | Create the Prometheus monitoring component. | `true` |
341414
| `prometheus.resources` | Resource limits and requests for prometheus containers. | `{}` |

docs/uplink/rest-api.md

Lines changed: 2 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -2,59 +2,7 @@
22

33
Inlets uplink tunnels and namespaces can be managed through a REST API.
44

5-
A quick note on TLS: when you expose the uplink API over the Internet, you should enable HTTPS to prevent snooping and tampering.
6-
7-
## Installation
8-
9-
The REST API is part of the client-api component, and is disabled by default.
10-
You'll need to configure authentication, then update the values.yaml file and install the chart again.
11-
12-
An access token needs to be created for the Client API before it can be deployed.
13-
14-
```sh
15-
# Generate a new access token
16-
export token=$(openssl rand -base64 32|tr -d '\n')
17-
echo -n $token > $HOME/.inlets/client-api
18-
19-
# Store the access token in a secret in the inlets namespace.
20-
kubectl create secret generic \
21-
client-api-token \
22-
-n inlets \
23-
--from-file client-api-token=$HOME/.inlets/client-api
24-
```
25-
26-
This token can be used to authenticate with the API.
27-
28-
> See the [OAuth configuration](#configure-oauth) section for instructions on how to enable OAuth.
29-
30-
Add the following parameters to your uplink `values.yaml` file and update the deployment:
31-
32-
```yaml
33-
clientApi:
34-
enable: true
35-
36-
tls:
37-
ingress:
38-
enabled: true
39-
```
40-
41-
By default, the client-api will be exposed on the same domain as the client-router under the `/v1` path prefix. For example, if your client-router domain is `uplink.example.com`, the API will be available at `https://uplink.example.com/v1`.
42-
43-
If you prefer to use a separate domain for the client-api, set the `clientApi.domain` field:
44-
45-
```yaml
46-
clientApi:
47-
enable: true
48-
49-
# Use a dedicated domain for the client API
50-
domain: clientapi.example.com
51-
52-
tls:
53-
ingress:
54-
enabled: true
55-
```
56-
57-
When a dedicated domain is set, a separate Ingress resource is created for the client-api.
5+
For setup instructions, including how to configure API authentication and enable the API ingress, see [Setup the REST API](/uplink/installation/#setup-the-rest-api).
586

597
## Authentication
608

@@ -74,7 +22,7 @@ Use the token as bearer token in the `Authorization` header when making requests
7422

7523
### OAuth
7624

77-
If you have OAuth enabled you can obtain a token from your provider that can be used to invoke the Uplink Client API.
25+
If you have OAuth enabled you can obtain a token from your provider that can be used to invoke the Uplink Client API. See [Configure OAuth](/uplink/installation/#configure-oauth) for setup instructions.
7826

7927
The example uses the client credentials grant. Replace the token url, client id and client secret with the values obtained from your identity provider.
8028

@@ -266,28 +214,3 @@ curl -i \
266214
-H "Authorization: Bearer ${TOKEN}" \
267215
"$CLIENT_API/v1/namespace/$NAME"
268216
```
269-
270-
## Configure OAuth
271-
272-
You can configure any OpenID Connect (OIDC) compatible identity provider for use with Inlets Uplink.
273-
274-
1. Register a new client (application) for Inlets Uplink with your identity provider.
275-
2. Enable the required authentication flows.
276-
The Client Credentials flow is ideal for serve-to-server interactions where there is no direct user involvement. This is the flow we recommend and use in our examples any other authentication flow can be picked depending on your use case.
277-
3. Configure Client API
278-
279-
Update your `values.yaml` file and add to following parameters to the `clientApi` section:
280-
281-
```yaml
282-
clientApi:
283-
# OIDC provider url.
284-
issuerURL: "https://myprovider.example.com"
285-
286-
# The audience is generally the same as the value of the domain field, however
287-
# some issuers like keycloak make the audience the client_id of the application/client.
288-
audience: "uplink.example.com"
289-
```
290-
291-
The `issuerURL` needs to be set to the url of your provider, eg. `https://accounts.google.com` for google or `https://example.eu.auth0.com/` for Auth0.
292-
293-
The `audience` is usually the client apis public URL although for some providers it can also be the client id.

0 commit comments

Comments
 (0)