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
+64-1Lines changed: 64 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,13 @@ A Golang replacement for the **[Kubeflow][kubeflow]** Jupyter Web APIs.
9
9
See **[CONTRIBUTING.md](CONTRIBUTING.md)**
10
10
11
11
## Development Environment
12
+
***Note that the frontend will report errors when calling `/api/namespaces` when run locally. This***
13
+
***issue does not arise in production, as the `/api/namespaces` endpoint is unused.***
14
+
15
+
To initialize the `.env` file for the development environment, use `task env`.
16
+
You will need to fill out your kubeflow cloud account and kubeflow namespace information manually.
17
+
The `thunder-tests` folder contains configuration for testing requests against the backend. Use the `vscode`
18
+
`THUNDER CLIENT` extension to load the tests.
12
19
13
20
### Run API Server
14
21
@@ -19,15 +26,42 @@ context. See _Connecting a Kubeflow cluster_ below for options.
19
26
2. Change directory to project root: `cd jupyter-apis`
20
27
3. Run `go run . -spawner-config samples/spawner_ui_config.yaml`
21
28
29
+
Alternatively,
30
+
31
+
1.`task go:dev -w -- -spawner-config samples/spawner_ui_config.yaml` will live-reload the Go server upon changes.
32
+
33
+
_Recommended_
34
+
35
+
You can use the vscode debugger to run the backend, just copy the below contents to a file at path `.vscode/launch.json`.
36
+
```json
37
+
{
38
+
"version": "0.2.0",
39
+
"configurations": [
40
+
{
41
+
"name": "Debug jupyter-api backend",
42
+
"type": "go",
43
+
"request": "launch",
44
+
"mode": "debug",
45
+
"program": ".",
46
+
"args": [
47
+
"-spawner-config",
48
+
"samples/spawner_ui_config.yaml",
49
+
],
50
+
"envFile": "${workspaceFolder}/.env"
51
+
}
52
+
]
53
+
}
54
+
```
55
+
22
56
### Run Front-End
23
57
24
58
The front-end is configured to proxy requests to the local API server. It
25
59
requires an environment variable (`KF_USER_ID`) to specify the current user –
26
60
this is passed to the API server as an HTTP header.
27
61
28
-
29
62
The following can be pasted in a script and executed. This uses the latest node lts version(v16.16.0).
30
63
**NOTE**: `user` is when using vagrant. Use the email adress if it is the dev cluser (please never connect to prod directly)
64
+
31
65
```
32
66
cd frontend/common/kubeflow-common-lib
33
67
npm i
@@ -44,6 +78,7 @@ KF_USER_ID=user npm start
44
78
For the kubecost data to be retrievable, the following will need to be executed `kubectl port-forward -n kubecost-system deployment/kubecost-cost-analyzer 9090`
45
79
46
80
### Older instructions
81
+
47
82
1.~Change directory to front-end folder: `cd frontend`~
48
83
2.~Install dependencies: `npm install`~
49
84
3.~Run the front-end `KF_USER_ID=<cloud_email> npm start`~
@@ -103,3 +138,31 @@ and run `vagrant up`.
103
138
104
139
[go]: https://golang.org/dl/
105
140
[kubeflow]: https://github.com/kubeflow/kubeflow
141
+
142
+
## Whats Different?
143
+
144
+
Routes are defined in this repository [here](./main.go).
145
+
146
+
[Upstream](https://github.com/kubeflow/kubeflow/tree/v1.6.0/components/crud-web-apps/jupyter/backend/apps/common/routes), the endpoints are structures via request type (e.g. `GET`, `PUT`, `DELETE`).
147
+
148
+
_Note_
149
+
150
+
-_that not all endpoints are included in the golang implementation_
151
+
-_to find the upstream endpoint, load the [Upstream](https://github.com/kubeflow/kubeflow/tree/v1.6.0/components/crud-web-apps/jupyter/backend/apps/common/routes)
| GET | /api/config |[/api/config](https://github.com/kubeflow/kubeflow/blob/v1.6.0/components/crud-web-apps/jupyter/backend/apps/common/routes/get.py#L9)||
157
+
| GET | /api/gpus |[/api/gpus](https://github.com/kubeflow/kubeflow/blob/v1.6.0/components/crud-web-apps/jupyter/backend/apps/common/routes/get.py#L52)||
158
+
| GET | /api/storageclasses/default |[/api/storageclasses/default](https://github.com/kubeflow/kubeflow/blob/v1.6.0/components/crud-web-apps/common/backend/kubeflow/kubeflow/crud_backend/routes/get.py#L26)||
159
+
| GET | /api/namespaces/{namespace}/cost/aggregated | Not found | Get the aggregated kubecost |
160
+
| GET | /api/namespaces |[/api/namespaces](https://github.com/kubeflow/kubeflow/blob/v1.6.0/components/crud-web-apps/common/backend/kubeflow/kubeflow/crud_backend/routes/get.py#L10)| Get the list of namespaces |
161
+
| GET | /api/namespaces/{namespace} | Not found | Get namespace metadata |
162
+
| GET | /api/namespaces/{namespace}/notebooks |[/api/namespaces/\<namespace\>/notebooks](https://github.com/kubeflow/kubeflow/blob/v1.6.0/components/crud-web-apps/jupyter/backend/apps/common/routes/get.py#L44)| Get the list of notebooks |
163
+
| POST | /api/namespaces/{namespace}/notebooks |[/api/namespaces/\<namespace\>/notebooks](https://github.com/kubeflow/kubeflow/blob/v1.6.0/components/crud-web-apps/jupyter/backend/apps/default/routes/post.py#L11)| Create a notebook |
164
+
| DELETE | /api/namespaces/{namespace}/notebooks/{notebook} |[/api/namespaces/\<namespace\>/notebooks/<notebook>](https://github.com/kubeflow/kubeflow/blob/v1.6.0/components/crud-web-apps/jupyter/backend/apps/common/routes/delete.py#L9)| Update a notebook |
165
+
| PATCH | /api/namespaces/{namespace}/notebooks/{notebook} |[/api/namespaces/\<namespace\>/notebooks/<notebook](https://github.com/kubeflow/kubeflow/blob/v1.6.0/components/crud-web-apps/jupyter/backend/apps/common/routes/patch.py#L19)| Delete a notebook |
166
+
| GET | /api/namespaces/{namespace}/pvcs |[/api/namespaces/\<namespace\>/pvc](https://github.com/kubeflow/kubeflow/blob/v1.6.0/components/crud-web-apps/jupyter/backend/apps/common/routes/get.py#L15)| List `PVC`s |
167
+
| DELETE | /api/namespaces/{namespace}/pvcs/{pvc} |[/api/namespaces/\<namespace\>/pvcs/<pvc>](https://github.com/kubeflow/kubeflow/blob/v1.6.0/components/crud-web-apps/volumes/backend/apps/default/routes/delete.py#L11)| Delete a `PVC`|
168
+
| GET | /api/namespaces/{namespace}/poddefaults |[/api/namespaces/\<namespace\>/poddefaults](https://github.com/kubeflow/kubeflow/blob/v1.6.0/components/crud-web-apps/jupyter/backend/apps/common/routes/get.py#L25)| Get `PodDefault`s for a given namespace |
Copy file name to clipboardExpand all lines: access.go
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -74,7 +74,7 @@ func (s *server) checkAccess(subjectAccessReviewTemplate authorizationv1.Subject
74
74
75
75
// If the user is not permitted, log and return the error and do not process the request
76
76
if!resp.Status.Allowed {
77
-
msg:=fmt.Sprintf("User %s is not permitted to %s %s.%s.%s for namespace: %s", sar.Spec.User, sar.Spec.ResourceAttributes.Verb, sar.Spec.ResourceAttributes.Group, sar.Spec.ResourceAttributes.Version, sar.Spec.ResourceAttributes.Resource, sar.Spec.ResourceAttributes.Namespace)
77
+
msg:=fmt.Sprintf("User %s is not permitted to %s %s.%s.%s for namespace: '%s'", sar.Spec.User, sar.Spec.ResourceAttributes.Verb, sar.Spec.ResourceAttributes.Group, sar.Spec.ResourceAttributes.Version, sar.Spec.ResourceAttributes.Resource, sar.Spec.ResourceAttributes.Namespace)
0 commit comments