You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -13,36 +13,44 @@ Lightspeed Core Stack (LCS) is an AI-powered assistant that provides answers to
13
13
14
14
<!-- vim-markdown-toc GFM -->
15
15
16
+
*[lightspeed-stack](#lightspeed-stack)
17
+
*[About The Project](#about-the-project)
16
18
*[Architecture](#architecture)
17
19
*[Prerequisites](#prerequisites)
18
20
*[Installation](#installation)
19
21
*[Configuration](#configuration)
20
-
*[Integration with Llama Stack](#integration-with-llama-stack)
21
-
*[Llama Stack as separate server](#llama-stack-as-separate-server)
22
-
*[Llama Stack project and configuration](#llama-stack-project-and-configuration)
23
-
*[Check connection to Llama Stack](#check-connection-to-llama-stack)
24
-
*[Llama Stack as client library](#llama-stack-as-client-library)
25
-
*[System prompt](#system-prompt)
26
-
*[Safety Shields](#safety-shields)
22
+
*[Integration with Llama Stack](#integration-with-llama-stack)
23
+
*[Llama Stack as separate server](#llama-stack-as-separate-server)
24
+
*[Llama Stack project and configuration](#llama-stack-project-and-configuration)
25
+
*[Check connection to Llama Stack](#check-connection-to-llama-stack)
26
+
*[Llama Stack as client library](#llama-stack-as-client-library)
27
+
*[System prompt](#system-prompt)
28
+
*[Safety Shields](#safety-shields)
29
+
*[Authentication](#authentication)
30
+
*[K8s based authentication](#k8s-based-authentication)
31
+
*[JSON Web Keyset based authentication](#json-web-keyset-based-authentication)
32
+
*[No-op authentication](#no-op-authentication)
27
33
*[Usage](#usage)
28
-
*[Make targets](#make-targets)
29
-
*[Running Linux container image](#running-linux-container-image)
34
+
*[Make targets](#make-targets)
35
+
*[Running Linux container image](#running-linux-container-image)
30
36
*[Endpoints](#endpoints)
31
-
*[OpenAPI specification](#openapi-specification)
32
-
*[Readiness Endpoint](#readiness-endpoint)
33
-
*[Liveness Endpoint](#liveness-endpoint)
37
+
*[OpenAPI specification](#openapi-specification)
38
+
*[Readiness Endpoint](#readiness-endpoint)
39
+
*[Liveness Endpoint](#liveness-endpoint)
34
40
*[Publish the service as Python package on PyPI](#publish-the-service-as-python-package-on-pypi)
35
-
*[Generate distribution archives to be uploaded into Python registry](#generate-distribution-archives-to-be-uploaded-into-python-registry)
36
-
*[Upload distribution archives into selected Python registry](#upload-distribution-archives-into-selected-python-registry)
37
-
*[Packages on PyPI and Test PyPI](#packages-on-pypi-and-test-pypi)
41
+
*[Generate distribution archives to be uploaded into Python registry](#generate-distribution-archives-to-be-uploaded-into-python-registry)
42
+
*[Upload distribution archives into selected Python registry](#upload-distribution-archives-into-selected-python-registry)
43
+
*[Packages on PyPI and Test PyPI](#packages-on-pypi-and-test-pypi)
38
44
*[Contributing](#contributing)
39
45
*[Testing](#testing)
40
46
*[License](#license)
41
47
*[Additional tools](#additional-tools)
42
-
*[Utility to generate OpenAPI schema](#utility-to-generate-openapi-schema)
43
-
* [Path](#path)
44
-
* [Usage](#usage-1)
45
-
48
+
*[Utility to generate OpenAPI schema](#utility-to-generate-openapi-schema)
49
+
*[Path](#path)
50
+
*[Usage](#usage-1)
51
+
*[Project structure](#project-structure)
52
+
*[Configuration classes](#configuration-classes)
53
+
*[REST API](#rest-api)
46
54
47
55
<!-- vim-markdown-toc -->
48
56
@@ -227,6 +235,104 @@ utilized:
227
235
1. If the `shield_id` starts with `inout_`, it will be used both for input and output.
228
236
1. Otherwise, it will be used for input only.
229
237
238
+
## Authentication
239
+
240
+
Currently supported authentication modules are:
241
+
* `k8s` Kubernetes based authentication
242
+
* `jwk-token` JSON Web Keyset based authentication
243
+
* `noop` No operation authentication (default)
244
+
* `noop-with-token` No operation authentication with token
245
+
246
+
### K8s based authentication
247
+
248
+
K8s based authentication is suitable for running the Lightspeed Stack in Kubernetes environments.
249
+
The user accessing the service must have a valid Kubernetes token and the appropriate RBAC permissions to access the service.
250
+
The user must have `get` permission on the Kubernetes RBAC non-resource URL `/ls-access`.
251
+
Here is an example of granting `get` on `/ls-access` via a ClusterRole’s nonResourceURLs rule.
252
+
Example:
253
+
```yaml
254
+
# Allow GET on non-resource URL /ls-access
255
+
apiVersion: rbac.authorization.k8s.io/v1
256
+
kind: ClusterRole
257
+
metadata:
258
+
name: lightspeed-access
259
+
rules:
260
+
- nonResourceURLs: ["/ls-access"]
261
+
verbs: ["get"]
262
+
---
263
+
# Bind to a user, group, or service account
264
+
apiVersion: rbac.authorization.k8s.io/v1
265
+
kind: ClusterRoleBinding
266
+
metadata:
267
+
name: lightspeed-access-binding
268
+
roleRef:
269
+
apiGroup: rbac.authorization.k8s.io
270
+
kind: ClusterRole
271
+
name: lightspeed-access
272
+
subjects:
273
+
- kind: User # or ServiceAccount, Group
274
+
name: SOME_USER_OR_SA
275
+
apiGroup: rbac.authorization.k8s.io
276
+
```
277
+
278
+
Configuring K8s based authentication requires the following steps:
279
+
1. Enable K8s authentication module
280
+
```yaml
281
+
authentication:
282
+
module: "k8s"
283
+
```
284
+
2. Configure the Kubernetes authentication settings.
285
+
When deploying Lightspeed Stack in a Kubernetes cluster, it is not required to specify cluster connection details.
286
+
It automatically picks up the in-cluster configuration or through a kubeconfig file.
287
+
This step is not neccessary.
288
+
When running outside a kubernetes cluster or connecting to external Kubernetes clusters, Lightspeed Stack requires the cluster connection details in the configuration file:
289
+
- `k8s_cluster_api`Kubernetes Cluster API URL. The URL of the K8S/OCP API server where tokens are validated.
290
+
- `k8s_ca_cert_path`Path to the CA certificate file for clusters with self-signed certificates.
291
+
- `skip_tls_verification`Whether to skip TLS verification.
JWK (JSON Web Keyset) based authentication is suitable for scenarios where you need to authenticate users based on tokens. This method is commonly used in web applications and APIs.
303
+
304
+
To configure JWK based authentication, you need to specify the following settings in the configuration file:
305
+
- `module`must be set to `jwk-token`
306
+
- `jwk_config` JWK configuration settings must set at least `url` field:
0 commit comments