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
Copy file name to clipboardExpand all lines: README.md
+19-23
Original file line number
Diff line number
Diff line change
@@ -4,25 +4,17 @@
4
4
5
5
## About this project
6
6
7
-
UI backend for @openmcp-project
7
+
This is the backend for our [MCP UI](https://github.com/openmcp-project/ui-frontend).
8
+
Its a simple proxy server which sits between the UI frontend and the Kubernetes API server.
8
9
9
-
## Requirements and Setup
10
-
11
-
Setup: Requires the CRATE_KUBECONFIG environment variable.
12
-
Start: Instructions to run the server using go run cmd/server/main.go.
13
-
Call UI-backend: Details on how to make requests to the ui-backend with necessary headers for authorization and target API server configuration.
14
-
Parsing JSON: Support for jsonpath and jq to parse JSON before sending it to the client.
15
-
16
-
### Use Case
17
-
18
-
#### Problem
10
+
### Motivation
19
11
20
12
We want to call the kubernetes api server directly from the browser, but we have several problems preventing us from calling the api from the browser:
21
13
22
14
- TLS certificate is not signed from a well-known CA
23
15
- CORS is not configured most of the time
24
16
25
-
####Solution
17
+
### Solution
26
18
27
19
The `ui-backend` server acts like a proxy when talking to the Crate-Cluster or MCPs from the browser.
28
20
The browser sends the request to the `ui-backend`, with authorization data and optionally the project, workspace and controlplane name of the MCP in header data.
@@ -32,34 +24,39 @@ The browser sends the request to the `ui-backend`, with authorization data and o
32
24
33
25
There are only some modifications done when piping the request to the api server, preventing some headers from going through.
34
26
35
-
### Usage
27
+
## Requirements and Setup
28
+
29
+
You need to have a running mcp landscape. Then reference the KUBECONFIG for the backend using the `KUBECONFIG` environment variable.
36
30
37
-
#### Setup
31
+
The backend can be started using:
38
32
39
-
The service needs only one mandatory environment variable, `CRATE_KUBECONFIG`, with the kubeconfig-yaml as a string. The `.users` field does not has to be set, as this part will get overwritten with the data from the requests.
33
+
```bash
34
+
go run cmd/server/main.go
35
+
```
40
36
41
-
#### Start
37
+
##Usage
42
38
43
-
Run `go run cmd/server/main.go`
39
+
You can reach the backend on port `3000` and the path as you would directly to the api server.
44
40
45
-
#### Call UI-backend
41
+
```txt
42
+
For example: http://localhost:3000/api/v1/namespaces
43
+
```
46
44
47
-
Call `ui-backend` with the http-method and path as you would directly to the api server.
48
45
Put the authorization data in the following headers:
49
46
50
47
-`X-Client-Certificate-Data`
51
48
-`X-Client-Key-Data`
52
49
53
50
or (for OIDC):
54
51
55
-
-`Authorization`
52
+
-`Authorization: <token>`
56
53
57
54
Also configure the api-server you want to call:
58
55
59
56
- Crate: Add the header `X-Use-Crate-Cluster: true`
60
57
- MCP: Add the headers `X-Project-Name`, `X-Workspace-Name` and `X-Control-Plane-Name`
61
58
62
-
####Parsing JSON
59
+
## Parsing JSON
63
60
64
61
`ui-backend` support jsonpath (kubectl version) and jq (gojq) to parse json before sending it to the client, reducing the data transfered to the client.
0 commit comments