* wa(back): Add helper for deserializing JSON obj In some cases we might need to construct Python k8s lib objects from the JSONs that are provided by clients. I.e. the UI will be sending a PVC object in json format, so the backend will need to create the corresponding client.V1PersistentVolumeClaim object and submit it. Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com> Reviewed-by: Ilias Katsakioris <elikatsis@arrikto.com> * wa(back): Serialization helper Add helper function for converting a k8s-client object into a dict that can be sent as an HTTP response. Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com> Reviewed-by: Ilias Katsakioris <elikatsis@arrikto.com> * wa(back): Add dry run to Notebooks and PVCs The backend will need to be able to create objects with dry-run, in order to ensure they are valid. The backend will need to check that both the Notebook and the PVCs can be created beforehand. This way we avoid the scenario where we create PVCs but the Notebook fails to be created, and the PVCs are never garbage collected. Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com> Reviewed-by: Ilias Katsakioris <elikatsis@arrikto.com> * wa(back): Update kubernetes to 0.17 In order to support dry-run we must use the 0.17 version of the Python k8s client. Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com> Reviewed-by: Ilias Katsakioris <elikatsis@arrikto.com> * wa(back): Extend api module to patch pvcs The backend will need to be able to PATCH PVCs in order to set the ownerReference to the Notebook that mounts the PVCs. Ref: arrikto/dev/issues/386#issuecomment-856700392 Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com> Reviewed-by: Ilias Katsakioris <elikatsis@arrikto.com> * jwa(back): Work with new Volumes API The backend API should not add any more layers of abstractions on top of the K8s API. The backend should expect the client/UI to be sending the entire PVC spec of a new PVC. Refs: arrikto/dev/issues/386 Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com> Reviewed-by: Ilias Katsakioris <elikatsis@arrikto.com> * jwa(back): Add unittests for new volumes API Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com> Reviewed-by: Ilias Katsakioris <elikatsis@arrikto.com> * jwa(back): Extend the PVC info returned We want to show both the access mode and size of the existing PVCs, when a user clicks on the dropdown to select which PVC to mount. The backend will need to provide this information to the frontend. We don't want to send the K8s list of PVCs since this will result in a lot of unnecessary data to be sent. Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com> Reviewed-by: Ilias Katsakioris <elikatsis@arrikto.com> * jwa(front): Add proxy config for Rok When developing the Rok flavor locally we will need to be able to open the Rok chooser. This can be done by using Angular/webpack proxy to bring the exposed rok service and the app under the same domain. Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com> Reviewed-by: Tasos Alexiou <tasos@arrikto.com> * jwa(front): Remove card from form The form of the app should not be a big card, but a normal form. Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com> Reviewed-by: Tasos Alexiou <tasos@arrikto.com> * jwa(front): Install AceModule for yaml editing Install AceModule to allow users to edit yamls of objects. Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com> Reviewed-by: Tasos Alexiou <tasos@arrikto.com> * wa(front): Change the styling of form sections Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com> Reviewed-by: Tasos Alexiou <tasos@arrikto.com> * jwa(front): Create common volume components Component for: * New PVC and configuring its spec * Attaching an existing PVC in a Notebook Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com> Reviewed-by: Tasos Alexiou <tasos@arrikto.com> * jwa(front): Update Rok form for new Volume API Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com> Reviewed-by: Tasos Alexiou <tasos@arrikto.com> * jwa(front): Mark inputs as dirty when restoring Lab When the UI autofills the form with values from a JupyterLab snapshot then it should mark the touched fields as dirty. This way if a field has errors the UI will make that input red. Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com> Reviewed-by: Tasos Alexiou <tasos@arrikto.com> * jwa: Update ConfigMap in manifests Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com> * jwa(front): Fix format errors Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com> |
||
|---|---|---|
| .. | ||
| backend | ||
| frontend | ||
| manifests | ||
| .gitignore | ||
| Dockerfile | ||
| Makefile | ||
| README.md | ||
README.md
Jupyter web app
This web app is responsible for allowing the user to manipulate the Jupyter Notebooks in their Kubeflow cluster. To achieve this it provides a user friendly way to handle the lifecycle of Notebook CRs.
Image Groups
With the release of Kubeflow 1.3, two types have Notebook Servers have been added alongside the familiar JupyterLab:
- Group 1
- Group 2
Some extra configurations are applied Notebook Servers belonging to these groups:
The annotation notebooks.kubeflow.org/http-rewrite-uri: / is added to Notebook
resources of both groups. This configures Istio to rewrite the URI to / on
the container. This is useful for applications which host their on /
and do not allow you to change the URI subpath easily.
The annotation notebooks.kubeflow.org/http-headers-request-set:
'{"X-RStudio-Root-Path":"/notebook/<namespace>/<name>/"}' is added to
Notebook resources belonging to Group 2. This configures Istio to add
this header to requests, which is necessary for images from Group 2 to work.
The Jupyter Web App displays the logos for each Notebook Server group in a button toggle in the Spawner UI. To easily identify the group of a running Notebook Server, the Index page contains a column that displays the icon for each image group. The SVG logos and icons for each group are added with a configmap to make it easy for users to customize the logos and icons for their environment.
Development
Requirements:
- node 12.0.0
- python 3.7
Frontend
# build the common library
cd components/crud-web-apps/common/frontend/kubeflow-common-lib
npm i
npm run build
cd dist/kubeflow
npm link
# build the app frontend
cd ../../../jupyter/frontend
npm i
npm link kubeflow
npm run build:watch
Backend
# create a virtual env and install deps
# https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/
cd components/crud-web-apps/jupyter/backend
python3.7 -m pip install --user virtualenv
python3.7 -m venv web-apps-dev
source web-apps-dev/bin/activate
# install the deps on the activated virtual env
make -C backend install-deps
# run the backend
make -C backend run-dev
Internationalization
Support for non-English languages is only supported in a best effort way.
Internationalization(i18n) was implemented using Angular's i18n guide and practices, in the frontend. You can use the following methods to ensure the text of the app will be localized:
i18nattribute in html elements, if the node's text should be translatedi18n-{attribute}in an html element, if the element's attribute should be translated- $localize to mark text in TypeScript variables that should be translated
The file for the English text is located under i18n/messages.xlf and other
languages under their respective locale folder, i.e. i18n/fr/messages.fr.xfl.
Each language's folder, aside from English, should have a distinct and up to
date OWNERs file that reflects the maintainers of that language.
Testing
You can run a different translation of the app, locally, by running
ng serve --configuration=fr
You must also ensure that the backend is running, since Angular's dev server
will be proxying request to the backend at localhost:5000.
E2E Tests
To run the tests locally users will need to:
# navigate to the frontend and make sure the node modules are installed
cd frontend
npm i
# ensure the backend is running and serving the files under localhost:5000
# you can run the backend with: make run-dev
# run the tests
npm run e2e