Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't create PVCs if no default StorageClass is set #2679

Merged
merged 13 commits into from
Mar 20, 2019

Conversation

kimwnasptd
Copy link
Member

@kimwnasptd kimwnasptd commented Mar 11, 2019

closes #2157

If no default StorageClass is set, then the user won't be able to create New PVCs for the Notebooks using the Jupyter UI.

/assign @jlewi

/hold
wait for #2671


This change is Reviewable

If no default StorageClass is provided, then we don't let the
users create new Volumes. Neither Workspace nor Data Volumes.

Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com>
Function for
* Loading the rok secret
* Decoding the parameterized ROK_SECRET_NAME with a user value

The user value will currently always be 'user'

Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com>
Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com>
Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com>
Instead of using hand-made dicts for pvcs, use client
classes for kubernetes objects.

Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com>
Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com>
Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com>
Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com>
@jlewi
Copy link
Contributor

jlewi commented Mar 13, 2019

@avdaredevil
/assign @prodonjs

Could you review this please?

Copy link
Contributor

@prodonjs prodonjs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made a few comments. In general, I am looking at this for the very first time so I don't know how useful my context is. I just saw a few things that I thought looked like they might be confusing if I were going to try to come in and make subsequent changes in this module.

return


def create_datavol_pvc(body, i):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally I think there would be some kind of definition for the shape of the body dict being passed in, but since I have almost no context of looking at this I'm not going to be picky.

@@ -60,5 +133,5 @@ def create_notebook(body):


def create_pvc(body):
ns = body['metadata']['namespace']
ns = body.metadata.namespace
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So in this case body has actually changed from a dict to an object. Again, having no context it may be helpful to have some kind of comment or change the name of the param to reflect that it's not a deserialized JSON response as a dict but is not a typed object.

try:
create_pvc(pvc)
create_workspace_pvc(body)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code here looks very similar to components/jupyter-web-app/default/kubeflow/jupyter/server.py. Again, I wouldn't want to request any significant changes with so little context but it does seem like it would advantageous to factor out this code into a single shared module.

* Create baseui module to reduce code duplication
* Edit Makefile to run the webapps

Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com>
Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com>
Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com>
* Add more comments to make the code more descriptive
* Replace single quotes with double ones
* Add readme for baseui module

Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com>
Copy link
Member Author

@kimwnasptd kimwnasptd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for reviewing it @prodonjs, I also added you and @avdaredevil as reviewers

Reviewable status: 0 of 28 files reviewed, 3 unresolved discussions (waiting on @prodonjs and @vkoukis)


components/jupyter-web-app/rok/kubeflow/rokui/routes.py, line 52 at r1 (raw file):

Previously, prodonjs (Jason Prodonovich) wrote…

The code here looks very similar to components/jupyter-web-app/default/kubeflow/jupyter/server.py. Again, I wouldn't want to request any significant changes with so little context but it does seem like it would advantageous to factor out this code into a single shared module.

Sure! I reorganized the structure of the code and put the repetitive code in a module.


components/jupyter-web-app/default/kubeflow/jupyter/server.py, line 56 at r1 (raw file):

Previously, prodonjs (Jason Prodonovich) wrote…

Ideally I think there would be some kind of definition for the shape of the body dict being passed in, but since I have almost no context of looking at this I'm not going to be picky.

Do you mean to add a definition to the backend or have it in a README/spec, for example, to make it clear?


components/jupyter-web-app/default/kubeflow/jupyter/server.py, line 136 at r1 (raw file):

Previously, prodonjs (Jason Prodonovich) wrote…

So in this case body has actually changed from a dict to an object. Again, having no context it may be helpful to have some kind of comment or change the name of the param to reflect that it's not a deserialized JSON response as a dict but is not a typed object.

Done.

Added some relative comments in other places to provide more context to the viewer

Copy link
Contributor

@avdaredevil avdaredevil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good otherwise!

@@ -3,3 +3,5 @@ approvers:
- kimwnasptd
reviewers:
- vkoukis
- prodonjs
- avdaredevil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please alphabetically sort

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! lgtm-ing

Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com>
@kimwnasptd
Copy link
Member Author

/hold cancel

@avdaredevil
Copy link
Contributor

/lgtm

@prodonjs
Copy link
Contributor

/lgtm
/approve

@kimwnasptd
Copy link
Member Author

@lluunn could you please approve this PR?

@lluunn
Copy link
Contributor

lluunn commented Mar 20, 2019

/approve
sorry missed this

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lluunn, prodonjs

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit b066e07 into kubeflow:master Mar 20, 2019
saffaalvi pushed a commit to StatCan/kubeflow that referenced this pull request Feb 11, 2021
* Check for default StorageClass

If no default StorageClass is provided, then we don't let the
users create new Volumes. Neither Workspace nor Data Volumes.

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

* Use client for creating pvcs

Instead of using hand-made dicts for pvcs, use client
classes for kubernetes objects.

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

* Fix sharp corners

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

* Add helper functions

Function for
* Loading the rok secret
* Decoding the parameterized ROK_SECRET_NAME with a user value

The user value will currently always be 'user'

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

* Handle the token from the html

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

* Refactor code. Cleanup post_notebook()

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

* Add permissions to list storage classes

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

* Add logging

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

* Reorganize code

* Create baseui module to reduce code duplication
* Edit Makefile to run the webapps

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

* Update the Dockerfile

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

* Add prodonjs and avdaredevil as Reviewers

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

* Add comments

* Add more comments to make the code more descriptive
* Replace single quotes with double ones
* Add readme for baseui module

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

* Sort OWNERS

Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com>
saffaalvi pushed a commit to StatCan/kubeflow that referenced this pull request Feb 12, 2021
* Check for default StorageClass

If no default StorageClass is provided, then we don't let the
users create new Volumes. Neither Workspace nor Data Volumes.

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

* Use client for creating pvcs

Instead of using hand-made dicts for pvcs, use client
classes for kubernetes objects.

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

* Fix sharp corners

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

* Add helper functions

Function for
* Loading the rok secret
* Decoding the parameterized ROK_SECRET_NAME with a user value

The user value will currently always be 'user'

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

* Handle the token from the html

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

* Refactor code. Cleanup post_notebook()

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

* Add permissions to list storage classes

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

* Add logging

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

* Reorganize code

* Create baseui module to reduce code duplication
* Edit Makefile to run the webapps

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

* Update the Dockerfile

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

* Add prodonjs and avdaredevil as Reviewers

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

* Add comments

* Add more comments to make the code more descriptive
* Replace single quotes with double ones
* Add readme for baseui module

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

* Sort OWNERS

Signed-off-by: Kimonas Sotirchos <kimwnasptd@arrikto.com>
@kimwnasptd kimwnasptd deleted the feature-webapp-storageclass branch May 19, 2021 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Notebook manager UI should disable New PVC option if no default storage class is defined.
7 participants