* Create Tensorboard web-app backend Create the code for the Tensorboard web-app backend which includes routes for GET, POST and DELETE requests. The backend is created with Python/Flask, so it also uses the common code from 'kubeflow.kubeflow.crud_backend'. * Add 'get_age(k8s_object)' function to 'crud_backend' common code It would be useful for all web apps of the 'crud-web-apps' folder to return age information to their frontends. As a result, 'get_age(k8s_object)' was added to the common code, so that all web apps can use it. |
||
|---|---|---|
| .. | ||
| backend | ||
| README.md | ||
README.md
Common code for CRUD web apps
Since our CRUD web apps like the Jupyter, Tensorboards and Volumes UIs are similarly build with Angular and Python/Flask we should factor the common code in to modules and libraries.
This directory will contain:
- A Python package with a base backend. Each one of the mentioned apps are supposed to extend this backend.
- An Angular library that will contain the common frontend code that these apps will be sharing
Backend
The backend will be exposing a base backend which will be taking care of:
- Serving the Single Page Application
- Adding liveness/readiness probes
- Authentication based on the
kubeflow-useridheader - Authorization using SubjectAccessReviews
- Uniform logging
- Exceptions handling
- Common helper functions for dates, yaml file parsing etc.
How to use
In order to use this code during the development process one could use the -e flag with pip install. For example:
# I'm currently in /components/crud-web-apps/volumes/backend
cd ../../common/backend && pip install -e .
This will install all the dependencies of the package and you will now be able to include code from kubeflow.kubeflow.crud_backend in you current Python environment.
In order to build a Docker image and use this code you coud build a wheel and then install it:
FROM python:3.7 AS backend-kubeflow-wheel
WORKDIR /src
COPY ./components/crud-web-apps/common/backend .
RUN python3 setup.py bdist_wheel
...
# Web App
FROM python:3.7
WORKDIR /package
COPY --from=backend-kubeflow-wheel /src .
RUN pip3 install .
...