From 541782111fd73c8578f824f3921984766c269f6b 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 e3a33c2b195fd0800b4a09f37599f09e1c436e73 Mon Sep 17 00:00:00 2001 From: Ivan Chvets Date: Wed, 1 Nov 2023 11:46:24 -0400 Subject: [PATCH 2/2] fix: update ui charm config https://github.com/canonical/notebook-operators/issues/312 Summary of changes: - Updated Jupyter UI charm config to point to updated ROCKs. --- charms/jupyter-ui/config.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/charms/jupyter-ui/config.yaml b/charms/jupyter-ui/config.yaml index 9e58f270..025712c1 100644 --- a/charms/jupyter-ui/config.yaml +++ b/charms/jupyter-ui/config.yaml @@ -22,11 +22,11 @@ options: jupyter-images: type: string default: | - - charmedkubeflow/jupyter-scipy:v1.7.0_20.04_1 - - charmedkubeflow/jupyter-pytorch-full:v1.7.0_20.04_1 - - charmedkubeflow/jupyter-pytorch-cuda-full:v1.7.0_20.04_1 - - charmedkubeflow/jupyter-tensorflow-full:v1.7.0_20.04_1 - - charmedkubeflow/jupyter-tensorflow-cuda-full:v1.7.0_20.04_1 + - charmedkubeflow/jupyter-scipy:v1.7.0-20.04-1_ad4e002 + - charmedkubeflow/jupyter-pytorch-full:v1.7.0-20.04-1_ad4e002 + - charmedkubeflow/jupyter-pytorch-cuda-full:v1.7.0-20.04-1_ad4e002 + - charmedkubeflow/jupyter-tensorflow-full:v1.7.0-20.04-1_ad4e002 + - charmedkubeflow/jupyter-tensorflow-cuda-full:v1.7.0-20.04-1_ad4e002 description: list of image options for Jupyter Notebook rstudio-images: type: string