From d3e6d390d382716ac8fea952618f832a4a19f1ea Mon Sep 17 00:00:00 2001 From: i-chvets <113444075+i-chvets@users.noreply.github.com> Date: Tue, 28 Mar 2023 09:17:58 -0400 Subject: [PATCH 1/2] [KF-1471] fix: add default value for pipelines (#221) * fix: add default value for pipelines https://github.com/canonical/kfp-operators/issues/159 Fixes #159 Summary of changes: - Added back default value for pipelines access. - Added tests for default values of pipelines access and images for 1.7 release. - Modified code to check for mindspore image only not version. --------- Co-authored-by: Andrew Scribner --- charms/jupyter-ui/src/spawner_ui_config.yaml | 8 ++++++- charms/jupyter-ui/tests/unit/test_operator.py | 22 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/charms/jupyter-ui/src/spawner_ui_config.yaml b/charms/jupyter-ui/src/spawner_ui_config.yaml index d7123ff7..2fb949b1 100644 --- a/charms/jupyter-ui/src/spawner_ui_config.yaml +++ b/charms/jupyter-ui/src/spawner_ui_config.yaml @@ -180,5 +180,11 @@ spawnerFormDefaults: # value: # - add-gcp-secret # - default-editor - value: [] + value: + # Added from https://github.com/kubeflow/kubeflow/pull/6160 to fix + # https://github.com/canonical/bundle-kubeflow/issues/423. This was not yet in + # upstream and if they go with something different we should consider syncing with + # upstream. + # Auto-selects "Allow access to Kubeflow Pipelines" button in Notebook spawner UI + - access-ml-pipeline readOnly: false diff --git a/charms/jupyter-ui/tests/unit/test_operator.py b/charms/jupyter-ui/tests/unit/test_operator.py index 13538929..3cbbc8fd 100644 --- a/charms/jupyter-ui/tests/unit/test_operator.py +++ b/charms/jupyter-ui/tests/unit/test_operator.py @@ -4,6 +4,7 @@ """Unit tests for JupyterUI Charm.""" +from pathlib import Path from unittest.mock import MagicMock, patch import pytest @@ -28,6 +29,27 @@ def harness() -> Harness: class TestCharm: """Test class for JupyterUI.""" + def test_spawner_ui(self): + """Test spawner UI. + + spawner_ui_config.yaml contains a number of changes that were done for Charmed + Kubeflow. This test is to validate those. If it fails, spawner_ui_config.yaml + should be reviewed and changes to this tests should be made, if required. + """ + spawner_ui_config = yaml.safe_load(Path("./src/spawner_ui_config.yaml").read_text()) + + # test for default configurations + # only single configuration value is currently set in the list of values + config_value = spawner_ui_config["spawnerFormDefaults"]["configurations"]["value"] + assert config_value == ["access-ml-pipeline"] + + # test for images added in addition to upstream + image_list = spawner_ui_config["spawnerFormDefaults"]["image"]["options"] + assert any( + "swr.cn-south-1.myhuaweicloud.com/mindspore/jupyter-mindspore" in image + for image in image_list + ) + @patch("charm.KubernetesServicePatch", lambda x, y, service_name: None) @patch("charm.JupyterUI.k8s_resource_handler") def test_not_leader(self, k8s_resource_handler: MagicMock, harness: Harness): From 4102e9fe17b2447821ceceb35bce0fe384a28921 Mon Sep 17 00:00:00 2001 From: Daniela Plascencia Date: Tue, 28 Mar 2023 21:36:19 +0200 Subject: [PATCH 2/2] feat: version bump 1.7.0-rc.1->1.7.0 (#231) --- charms/jupyter-controller/metadata.yaml | 2 +- charms/jupyter-ui/metadata.yaml | 2 +- charms/jupyter-ui/src/spawner_ui_config.yaml | 20 ++++++++++---------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/charms/jupyter-controller/metadata.yaml b/charms/jupyter-controller/metadata.yaml index 2932de5a..26ef25d6 100644 --- a/charms/jupyter-controller/metadata.yaml +++ b/charms/jupyter-controller/metadata.yaml @@ -7,7 +7,7 @@ resources: oci-image: type: oci-image description: 'Backing OCI image' - upstream-source: docker.io/kubeflownotebookswg/notebook-controller:v1.7.0-rc.1 + upstream-source: docker.io/kubeflownotebookswg/notebook-controller:v1.7.0 deployment: type: stateless service: omit diff --git a/charms/jupyter-ui/metadata.yaml b/charms/jupyter-ui/metadata.yaml index f7ea990c..8952f976 100644 --- a/charms/jupyter-ui/metadata.yaml +++ b/charms/jupyter-ui/metadata.yaml @@ -8,7 +8,7 @@ resources: oci-image: type: oci-image description: 'Backing OCI image' - upstream-source: docker.io/kubeflownotebookswg/jupyter-web-app:v1.7.0-rc.1 + upstream-source: docker.io/kubeflownotebookswg/jupyter-web-app:v1.7.0 requires: ingress: interface: ingress diff --git a/charms/jupyter-ui/src/spawner_ui_config.yaml b/charms/jupyter-ui/src/spawner_ui_config.yaml index 2fb949b1..eed0e4d6 100644 --- a/charms/jupyter-ui/src/spawner_ui_config.yaml +++ b/charms/jupyter-ui/src/spawner_ui_config.yaml @@ -18,24 +18,24 @@ spawnerFormDefaults: image: # The container Image for the user's Jupyter Notebook - value: kubeflownotebookswg/jupyter-scipy:v1.7.0-rc.1 + value: kubeflownotebookswg/jupyter-scipy:v1.7.0 # The list of available standard container Images options: - - kubeflownotebookswg/jupyter-scipy:v1.7.0-rc.1 - - kubeflownotebookswg/jupyter-pytorch-full:v1.7.0-rc.1 - - kubeflownotebookswg/jupyter-pytorch-cuda-full:v1.7.0-rc.1 - - kubeflownotebookswg/jupyter-tensorflow-full:v1.7.0-rc.1 - - kubeflownotebookswg/jupyter-tensorflow-cuda-full:v1.7.0-rc.1 + - kubeflownotebookswg/jupyter-scipy:v1.7.0 + - kubeflownotebookswg/jupyter-pytorch-full:v1.7.0 + - kubeflownotebookswg/jupyter-pytorch-cuda-full:v1.7.0 + - kubeflownotebookswg/jupyter-tensorflow-full:v1.7.0 + - kubeflownotebookswg/jupyter-tensorflow-cuda-full:v1.7.0 - swr.cn-south-1.myhuaweicloud.com/mindspore/jupyter-mindspore:v1.6.1 imageGroupOne: # The container Image for the user's Group One Server # The annotation `notebooks.kubeflow.org/http-rewrite-uri: /` # is applied to notebook in this group, configuring # the Istio rewrite for containers that host their web UI at `/` - value: kubeflownotebookswg/codeserver-python:v1.7.0-rc.1 + value: kubeflownotebookswg/codeserver-python:v1.7.0 # The list of available standard container Images options: - - kubeflownotebookswg/codeserver-python:v1.7.0-rc.1 + - kubeflownotebookswg/codeserver-python:v1.7.0 imageGroupTwo: # The container Image for the user's Group Two Server # The annotation `notebooks.kubeflow.org/http-rewrite-uri: /` @@ -44,10 +44,10 @@ spawnerFormDefaults: # The annotation `notebooks.kubeflow.org/http-headers-request-set` # is applied to notebook in this group, configuring Istio # to add the `X-RStudio-Root-Path` header to requests - value: kubeflownotebookswg/rstudio-tidyverse:v1.7.0-rc.1 + value: kubeflownotebookswg/rstudio-tidyverse:v1.7.0 # The list of available standard container Images options: - - kubeflownotebookswg/rstudio-tidyverse:v1.7.0-rc.1 + - kubeflownotebookswg/rstudio-tidyverse:v1.7.0 # If true, hide registry and/or tag name in the image selection dropdown hideRegistry: true hideTag: false