|
1 |
| -[](https://api.reuse.software/info/github.com/openmcp-project/ui-backend) |
2 |
| - |
3 | 1 | # ui-backend
|
4 | 2 |
|
| 3 | +[](https://api.reuse.software/info/github.com/openmcp-project/ui-backend) |
| 4 | + |
5 | 5 | ## About this project
|
6 | 6 |
|
7 | 7 | UI backend for @openmcp-project
|
8 | 8 |
|
9 | 9 | ## Requirements and Setup
|
10 | 10 |
|
11 |
| -*Insert a short description what is required to get your project running...* |
| 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 |
| 19 | + |
| 20 | +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 | + |
| 22 | +- TLS certificate is not signed from a well-known CA |
| 23 | +- CORS is not configured most of the time |
| 24 | + |
| 25 | +#### Solution |
| 26 | + |
| 27 | +The `ui-backend` server acts like a proxy when talking to the Crate-Cluster or MCPs from the browser. |
| 28 | +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. |
| 29 | + |
| 30 | +- If requesting the Crate: The request will get send to the crate cluster with the authorization data in the headers |
| 31 | +- If requesting an MCP: The `ui-backend` will call the Crate to get the `kubeconfig` of the MCP and then calls the MCP with that kubeconfig |
| 32 | + |
| 33 | +There are only some modifications done when piping the request to the api server, preventing some headers from going through. |
| 34 | + |
| 35 | +### Usage |
| 36 | + |
| 37 | +#### Setup |
| 38 | + |
| 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. |
| 40 | + |
| 41 | +#### Start |
| 42 | + |
| 43 | +Run `go run cmd/server/main.go` |
| 44 | + |
| 45 | +#### Call UI-backend |
| 46 | + |
| 47 | +Call `ui-backend` with the http-method and path as you would directly to the api server. |
| 48 | +Put the authorization data in the following headers: |
| 49 | + |
| 50 | +- `X-Client-Certificate-Data` |
| 51 | +- `X-Client-Key-Data` |
| 52 | + |
| 53 | +or (for OIDC): |
| 54 | + |
| 55 | +- `Authorization` |
| 56 | + |
| 57 | +Also configure the api-server you want to call: |
| 58 | + |
| 59 | +- Crate: Add the header `X-Use-Crate-Cluster: true` |
| 60 | +- MCP: Add the headers `X-Project-Name`, `X-Workspace-Name` and `X-Control-Plane-Name` |
| 61 | + |
| 62 | +#### Parsing JSON |
| 63 | + |
| 64 | +`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. |
| 65 | + |
| 66 | +Usage: |
| 67 | + |
| 68 | +- JsonPath: Add a header `X-jsonpath` with the jsonpath query |
| 69 | +- JQ: Add a header `X-jq` with the jq query |
| 70 | + |
| 71 | +### Deployment |
| 72 | + |
| 73 | +- Docker-Image: deploy-releases-hyperspace-docker.common.repositories.cloud.sap/cloud-orchestration/cola/ui-backend |
| 74 | +- Helm-Chart: oci://europe-docker.pkg.dev/sap-gcp-cp-k8s-stable-hub/cola/charts/ui-backend (is manually pushed) |
12 | 75 |
|
13 | 76 | ## Support, Feedback, Contributing
|
14 | 77 |
|
15 | 78 | This project is open to feature requests/suggestions, bug reports etc. via [GitHub issues](https://github.com/openmcp-project/ui-backend/issues). Contribution and feedback are encouraged and always welcome. For more information about how to contribute, the project structure, as well as additional contribution information, see our [Contribution Guidelines](CONTRIBUTING.md).
|
16 | 79 |
|
17 | 80 | ## Security / Disclosure
|
| 81 | + |
18 | 82 | If you find any bug that may be a security problem, please follow our instructions at [in our security policy](https://github.com/openmcp-project/ui-backend/security/policy) on how to report it. Please do not create GitHub issues for security-related doubts or problems.
|
19 | 83 |
|
20 | 84 | ## Code of Conduct
|
|
0 commit comments