Skip to content

Commit

Permalink
Cherry-pick latest commits to the 1.5-branch (#6354)
Browse files Browse the repository at this point in the history
* Fix(manifests): Upgrade rbac.authorization.k8s.io from v1beta1 to v1 (#6261)

* proposal: Extend Notebook Controller to expose idleness for Jupyter (#6295)

* proposal: Extend Notebook Controller to expose idleness for Jupyter (#6270)

Provide a design doc as a proposal for extending Notebook Controller to
expose idleness for Jupyter. Our proposal is in markdown format and follows
the guidelines of the kubeflow/components/proposal/README.md guide.

You can view the #6270 issue in the following link:
#6270

Signed-off-by: Athanasios Markou <athamark@arrikto.com>

* review: change the title of the proposal

Change the title of the proposal to only include the
proposed new feature. The new title of the proposal
will now be "Expose Idleness Information for Jupyter
Notebooks".

* review: rename the proposal markdown file

We want to give a more specific name to the markdown
which contains the proposal. Since this proposal
emphasizes on a feature regarding the Jupyter Notebooks,
the new name will be:

20220121-jupyter-notebook-idleness.md

* Synchronize jupyter-web-application role with clusterrole (#6241)

* Update role.yaml

* Update role.yaml

* Update cluster-role.yaml

* Kubeflow Roadmap update - with 1.5 details (#6266)

* Kubeflow Roadmap update - with 1.5 details

These proposed changes include: identifying that 1.4.1 has been delivered, provides themes for 1.5 and provides details of major features in 1.5 by working group.   This is an initial proposal that needs review by the working group leads.

* correct formatting in KFP features

Moved KFP features under KFP Control Flow doc

* updating KFP section

updating KFP references with updates from KFP team

* Updated the 1.5 release date to March

updated the 1.5 release date to March

* Update ROADMAP.md

change Hyperparameter leader election to Katib leader election

Co-authored-by: Andrey Velichkevich <andrey.velichkevich@gmail.com>

* Update ROADMAP.md

improve description and details of feature for metrics collector

Co-authored-by: Andrey Velichkevich <andrey.velichkevich@gmail.com>

* Update Katib description for Early stopping in 1.5

updating with Andrey's suggestion (but without the world proper).   * Validation for Early Stopping algorithm settings helps users to proper reduce model overfitting

Co-authored-by: Andrey Velichkevich <andrey.velichkevich@gmail.com>

* notebooks: Extend Notebook Controller to expose idleness for Jupyter (#6297)

* notebooks: Update image's tag in make

Modify Makefile to update properly the TAG
based on the git TAG.

Signed-off-by: Athanasios Markou <athamark@arrikto.com>
Reviewed-by: Kimonas Sotirchos <kimwnasptd@arrikto.com>

* notebooks: Expose last-activity

Extend the notebook-controller to:
* cull idle Notebook Servers based on their new `last-activity`
  annotation
* expose the last activity of each Notebook Server as an annotation
  on the metadata of the corresponding CR object

Modify notebook_controller.go to:
* update the Last Activity of each Notebook Server that has a
  Running pod
* delete the Last Activity Annotation for every Notebook Server
  that does not have a Running pod

Extend culler.go to:
* perform culling based on the new `last-activity` annotation and
  not based on the `/api/status` endpoint.
* update the last activity of a Notebook Server, based on the
  kernels' execution states.

Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com>
Reviewed-by: Athanasios Markou <athamark@arrikto.com>

* notebooks: Introduce a DEV env var

We introduce a DEV ENV var to allow admins
develop and test on their local machine their
custom Notebook Controller.
We provide information and instructions inside
the components/notebook-controller/README.md.

Signed-off-by: Athanasios Markou <athamark@arrikto.com>
Reviewed-by: Kimonas Sotirchos <kimwnasptd@arrikto.com>

* notebooks: Add unit tests for last-activity

* Introduce new tests for allKernelsAreIdle()
* Extend the tests for NotebookIsIdle() and for
  NotebookNeedsCulling().

Signed-off-by: Athanasios Markou <athamark@arrikto.com>
Reviewed-by: Kimonas Sotirchos <kimwnasptd@arrikto.com>

* review: UpdateNotebookLastActivityAnnotation()

Ensure that UpdateNotebookLastActivityAnnotation() does not return
"true". This function should not return any value.

Signed-off-by: Athanasios Markou <athamark@arrikto.com>

* jwa: Rework the Storage API of the web app (#6321)

* 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>

* profiles: Update the permissions for notebook idleness (#6335)

Extend the Profiles Controller to give permissions to Notebooks
controller for making GET requests to notebook's /api/kernels endpoint.

Refs https://github.com/kubeflow/kubeflow/blob/master/components/proposals/20220121-jupyter-notebook-idleness.md

Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com>

* notebooks: Graceful handling of events (#6338)

* notebooks: Handle events gracefully

The controller is not exiting the reconciliation loop after it has
re-emitted a Pod/STS Event as a Notebook Event. This results in the
controller to later on try and GET a Notebook with the name of the Event
that triggered the reconciliation loop.

The controller should exit the reconciliation function once it has
emitted the event.

Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com>

* notebooks: Don't reconcile on deleted events

We don't want to trigger the reconciliation function when an event gets
deleted.

If a Notebook would be deleted then the underlying events would
be deleted as well, which results in the reconcile function to get
triggered and try to GET Events and Notebooks with the name of the
deleted event.

Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com>

* notebooks: Fix endless restarts (#6341)

* notebooks: Update notebook if timestamp changed

We don't want to be updating the spec of the notebook if the timestamp
hasn't changed, since this will lead to constant updates and
reconciliation loops.

Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com>

* notebooks: Use a deep-copy of the notebook spec

The controller should use a deep-copy of the notebook spec when
calculating the spec for the StatefulSet. If not then we could
update the notebook object without wanting it, since the spec could have
been changed when calculating the STS spec.

Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com>

* notebooks: Add prefix env var only if missing

The controller should be setting OR updating the NB_PREFIX env var.
Previously it would always blindly append it to the spec, which could
result in double entries for the same env var.

Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com>

* releasing: Update tags for v1.5.0-rc.1 (#6343)

Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com>

Co-authored-by: Andrey Velichkevich <andrey.velichkevich@gmail.com>
  • Loading branch information
kimwnasptd and andreyvelich committed Feb 11, 2022
1 parent c055d52 commit 19ae712
Show file tree
Hide file tree
Showing 151 changed files with 3,861 additions and 2,101 deletions.
52 changes: 48 additions & 4 deletions ROADMAP.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,54 @@
# Kubeflow Roadmap

## Kubeflow 1.5 Release, Due: February 2022
* Kubeflow 1.5 timeline is tracked in [#538](https://github.com/kubeflow/community/pull/538)
* Additional details will be posted in early 1Q'22
## Kubeflow 1.5 Release, Due: March 2022
* Kubeflow 1.5 [milestones and timeline](https://github.com/kubeflow/community/pull/538)

### Themes
* Switching to [Emissary executor](https://www.kubeflow.org/docs/components/pipelines/installation/choose-executor/#emissary-executor) enables Kubeflow Pipelines deployment on Kubernetes >= v1.20, which runs on containerd runtime instead of Docker runtime
* Improve model accuracy and reduce overfitting, especially with hyper parameter tuning
* Simplify operations and optimize utilization (including spot instance use cases for distributed training)
* More consistent user experience - UI appearance, features and naming
* Improved documentation, tutorials and examples
* Stretch - Support for K8s 1.22 and associated dependencies (cert mgr, istio)

### Major Features from each Working Group (note: Individual WG versions are independent of Kubeflow's)

#### Kubeflow Pipelines, v1.8
* Switching to [Emissary executor](https://www.kubeflow.org/docs/components/pipelines/installation/choose-executor/#emissary-executor) enables Kubeflow Pipelines deployment on Kubernetes >= v1.20, which runs on containerd runtime instead of Docker runtime.

#### Katib, v0.13
* Katib controller leader election for HA operations and faster recovery
* Validation for Early Stopping algorithm settings helps users to reduce model overfitting
* Improve SDK, AWS CI, parameter settings across frameworks (goptuna, optuna, hyperopt)
* Update namespace label for Metrics Collector injection (note - breaking change)

#### Training Operator, v1.3
* Elastic Training for PyTorch, restarts pod rather than whole job, supports spot instances
* MPI addition to Unified training operator
* Python SDK supported on PyPI

#### Notebooks, Central Dashboard, Web Apps, Manifest, v1.5
* Exposing notebook idleness parameters, reduces infra used on idle notebooks
* UI consistency between web apps along with frontend pagination, and remove cards and user responsive tables
* Support for dark mode
* More options to define PVC specification

#### KServe, v0.7
* KFServing is rebranded to [KServe](https://github.com/kserve)
* [ModelMesh](https://github.com/kserve/modelmesh-serving) joins KServe
* Triton model serving runtime defaults to v21.09
* (Alpha feature) Raw kubernetes deployment support, Istio/Knative dependency is now optional

#### Detailed features, bug fixes and enhancements are identified in the Working Group Roadmaps

## Kubeflow 1.4.1 Release, Due: December 2021
* [Training Operators](https://github.com/kubeflow/common/blob/master/ROADMAP.md)
* [KFServing](https://github.com/kubeflow/kfserving/blob/master/ROADMAP.md)
* [Katib](https://github.com/kubeflow/katib/blob/master/ROADMAP.md)
* [Kubeflow Pipelines](https://github.com/kubeflow/pipelines/blob/master/ROADMAP.md)
* [Notebooks](https://github.com/kubeflow/kubeflow/issues/5978)


## Kubeflow 1.4.1 Release, Delivered: December 2021
* The need for a patch release was triggered by [#2082](https://github.com/kubeflow/manifests/issues/2082)
* 1.4.1 Tracking issue: [2084](https://github.com/kubeflow/manifests/issues/2082)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ commonLabels:
images:
- name: public.ecr.aws/j1r0q0g6/notebooks/admission-webhook
newName: public.ecr.aws/j1r0q0g6/notebooks/admission-webhook
newTag: v1.5.0-rc.0
newTag: v1.5.0-rc.1
namespace: kubeflow
generatorOptions:
disableNameSuffixHash: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ commonLabels:
images:
- name: public.ecr.aws/j1r0q0g6/notebooks/central-dashboard
newName: public.ecr.aws/j1r0q0g6/notebooks/central-dashboard
newTag: v1.5.0-rc.0
newTag: v1.5.0-rc.1
configMapGenerator:
- envs:
- params.env
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,12 @@ def create_custom_rsrc(group, version, kind, data, namespace):
namespace, kind, data)


def delete_custom_rsrc(group, version, kind, name, namespace, foreground=True):
del_policy = client.V1DeleteOptions()
if foreground:
del_policy = client.V1DeleteOptions(propagation_policy="Foreground")

def delete_custom_rsrc(group, version, kind, name, namespace,
policy="Foreground"):
authz.ensure_authorized("delete", group, version, kind, namespace)
return custom_api.delete_namespaced_custom_object(group, version,
namespace, kind, name,
del_policy)
return custom_api.delete_namespaced_custom_object(
group, version, namespace, kind, name, propagation_policy=policy
)


def list_custom_rsrc(group, version, kind, namespace):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from kubernetes import client

from .. import authz
from . import custom_api, v1_core

Expand All @@ -13,13 +11,14 @@ def get_notebook(notebook, namespace):
)


def create_notebook(notebook, namespace):
def create_notebook(notebook, namespace, dry_run=False):
authz.ensure_authorized(
"create", "kubeflow.org", "v1beta1", "notebooks", namespace
)

return custom_api.create_namespaced_custom_object(
"kubeflow.org", "v1beta1", namespace, "notebooks", notebook
)
"kubeflow.org", "v1beta1", namespace, "notebooks", notebook,
dry_run="All" if dry_run else None)


def list_notebooks(namespace):
Expand All @@ -36,12 +35,12 @@ def delete_notebook(notebook, namespace):
"delete", "kubeflow.org", "v1beta1", "notebooks", namespace
)
return custom_api.delete_namespaced_custom_object(
"kubeflow.org",
"v1beta1",
namespace,
"notebooks",
notebook,
client.V1DeleteOptions(propagation_policy="Foreground"),
group="kubeflow.org",
version="v1beta1",
namespace=namespace,
plural="notebooks",
name=notebook,
propagation_policy="Foreground",
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
from . import v1_core


def create_pvc(pvc, namespace):
def create_pvc(pvc, namespace, dry_run=False):
authz.ensure_authorized(
"create", "", "v1", "persistentvolumeclaims", namespace
)
return v1_core.create_namespaced_persistent_volume_claim(namespace, pvc)

return v1_core.create_namespaced_persistent_volume_claim(
namespace, pvc, dry_run="All" if dry_run else None)


def delete_pvc(pvc, namespace):
Expand All @@ -21,3 +23,12 @@ def list_pvcs(namespace):
"list", "", "v1", "persistentvolumeclaims", namespace
)
return v1_core.list_namespaced_persistent_volume_claim(namespace)


def patch_pvc(name, namespace, pvc, auth=True):
if auth:
authz.ensure_authorized("patch", "", "v1", "persistentvolumeclaims",
namespace)

return v1_core.patch_namespaced_persistent_volume_claim(name, namespace,
pvc)
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import json

from flask import jsonify
from kubernetes import client

from .. import authn

Expand Down Expand Up @@ -27,3 +30,21 @@ def failed_response(msg, error_code):

def events_field_selector(kind, name):
return "involvedObject.kind=%s,involvedObject.name=%s" % (kind, name)


def deserialize(json_obj, klass):
"""Convert a JSON object to a lib class object.
json_obj: The JSON object to deserialize
klass: The string name of the class i.e. V1Pod, V1Volume etc
"""
try:
return client.ApiClient()._ApiClient__deserialize(json_obj, klass)
except ValueError as e:
raise ValueError("Failed to deserialize input into '%s': %s"
% (klass, str(e)))


def serialize(obj):
"""Convert a K8s library object to JSON."""
return client.ApiClient().sanitize_for_serialization(obj)
2 changes: 1 addition & 1 deletion components/crud-web-apps/common/backend/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
REQUIRES = [
"Flask >= 1.1.1",
"Flask-API >= 2.0",
"kubernetes >= 10.0.1, < 11.0.0",
"kubernetes >= 11.0.1",
"requests >= 2.22.0",
"urllib3 >= 1.25.7",
"Werkzeug >= 0.16.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<div class="form--section-bottom">
<h3><lib-icon *ngIf="icon" [icon]="icon"></lib-icon>{{ title }}</h3>
<div class="header">
<lib-icon *ngIf="icon" [icon]="icon"></lib-icon>{{ title }}
</div>
<p>{{ text }}</p>
<p *ngIf="readOnly">*The cluster admin has disabled setting this section!</p>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
.wide {
width: 100%;
.header,
p {
margin-top: 0.2rem;
color: rgba(0, 0, 0, 0.66);
}

h3,
p {
margin-block-start: 0.2rem;
color: rgba(0, 0, 0, 0.54);
.header {
font-weight: 500;
font-size: 20px;
}

.lib-icon {
Expand All @@ -17,7 +18,3 @@ p {
.form--section-bottom {
margin-bottom: 0.5em;
}

.form--section-bottom > button {
margin-bottom: 0.5em;
}
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ body {
}

.mat-button-base.form--button-margin {
margin-right: 8px;
margin-right: 16px;
}

// Make the outline grey instead of black
Expand Down
3 changes: 3 additions & 0 deletions components/crud-web-apps/jupyter/backend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ install-deps:
popd
pip install -r requirements.txt

unittest:
python -m unittest discover --pattern "*_test.py"

run:
APP_PREFIX=/jupyter \
gunicorn -w 3 --bind 0.0.0.0:5000 --access-logfile - entrypoint:app
Expand Down
76 changes: 15 additions & 61 deletions components/crud-web-apps/jupyter/backend/apps/common/form.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,30 @@
URI_REWRITE_ANNOTATION = "notebooks.kubeflow.org/http-rewrite-uri"


def get_form_value(body, defaults, body_field, defaults_field=None):
def get_form_value(body, defaults, body_field, defaults_field=None,
optional=False):
"""
Get the value to set by respecting the readOnly configuration for
the field.
If the field does not exist in the configuration then just use the form
value.
"""
# The field in the defaults json not be the same in the request body
if defaults_field is None:
defaults_field = body_field

# If no default value exists then just return value in the request body.
# This is also useful if we add a new field and the configmap isn't updated
# yet
user_value = body.get(body_field, None)
if defaults_field not in defaults:
return user_value

readonly = defaults[defaults_field].get("readOnly", False)
default_value = defaults[defaults_field]["value"]

# if the value of a field is readonly then the request/form should not
# contain this field
if readonly:
if body_field in body:
raise BadRequest(
Expand All @@ -40,9 +47,14 @@ def get_form_value(body, defaults, body_field, defaults_field=None):
log.info("Using default value for '%s': %s", body_field, default_value)
return default_value

# field is not readonly
# field is not readonly and no value was provided
if user_value is None:
raise BadRequest("No value provided for: %s" % body_field)
if not optional:
raise BadRequest("No value provided for: %s" % body_field)

# no value for field, but it was optional
log.info("No value provided for '%s'", defaults_field)
return None

log.info("Using provided value for '%s': %s", body_field, user_value)
return user_value
Expand All @@ -59,64 +71,6 @@ def is_config_volume(vol):
return True


def volume_from_config(config_vol, notebook):
"""
Create a Volume Dict from the config.yaml. This dict has the same fields as
a Volume returned from the frontend
"""
vol_name = config_vol["name"]["value"].replace(
"{notebook-name}", notebook["name"]
)
vol_class = utils.get_storage_class(config_vol["class"]["value"])

return {
"name": vol_name,
"type": config_vol["type"]["value"],
"size": config_vol["size"]["value"],
"mode": config_vol["accessModes"]["value"],
"path": config_vol["mountPath"]["value"],
"class": vol_class,
"extraFields": config_vol.get("extra", {}),
}


def get_workspace_vol(body, defaults):
"""
Checks the config and the form values and returns a Volume Dict for the
workspace.
"""
if body.get("noWorkspace", False):
log.info("Requested to NOT use persistent storage for home dir")
return {}

workspace_vol = get_form_value(
body, defaults, "workspace", "workspaceVolume"
)

# check if it is a value from the config
if is_config_volume(workspace_vol):
workspace_vol = volume_from_config(workspace_vol, body)

return workspace_vol


def get_data_vols(body, defaults):
"""
Checks the config and the form values and returns a list of Volume
Dictionaries for the Notebook's Data Volumes.
"""
vols = get_form_value(body, defaults, "datavols", "dataVolumes")
data_vols = []

for vol in vols:
if is_config_volume(vol):
vol = volume_from_config(vol, body)

data_vols.append(vol)

return data_vols


# Notebook YAML processing
def set_notebook_image(notebook, body, defaults):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ def get_config():
@bp.route("/api/namespaces/<namespace>/pvcs")
def get_pvcs(namespace):
pvcs = api.list_pvcs(namespace).items
contents = [utils.pvc_dict_from_k8s_obj(pvc) for pvc in pvcs]
data = [{"name": pvc.metadata.name,
"size": pvc.spec.resources.requests["storage"],
"mode": pvc.spec.access_modes[0]} for pvc in pvcs]

return api.success_response("pvcs", contents)
return api.success_response("pvcs", data)


@bp.route("/api/namespaces/<namespace>/poddefaults")
Expand Down

0 comments on commit 19ae712

Please sign in to comment.