From 7abc97fea040e4cc4ed9d875f0430939f1d00536 Mon Sep 17 00:00:00 2001 From: Harshad Reddy Nalla Date: Tue, 9 May 2023 14:28:14 -0400 Subject: [PATCH 1/2] Enable patch version update for trustyai package (#80) Signed-off-by: Harshad Reddy Nalla --- jupyter/trustyai/ubi9-python-3.9/Pipfile | 2 +- jupyter/trustyai/ubi9-python-3.9/Pipfile.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jupyter/trustyai/ubi9-python-3.9/Pipfile b/jupyter/trustyai/ubi9-python-3.9/Pipfile index c6d553561..a4d7b7b91 100644 --- a/jupyter/trustyai/ubi9-python-3.9/Pipfile +++ b/jupyter/trustyai/ubi9-python-3.9/Pipfile @@ -7,7 +7,7 @@ name = "pypi" [packages] # TrustyAI and useful extensions -trustyai = "==0.2.12" +trustyai = "~=0.2.12" # Datascience and useful extensions elyra-pipeline-editor-extension = "~=3.15.0" diff --git a/jupyter/trustyai/ubi9-python-3.9/Pipfile.lock b/jupyter/trustyai/ubi9-python-3.9/Pipfile.lock index 1b1d88e69..d9f37f7ac 100644 --- a/jupyter/trustyai/ubi9-python-3.9/Pipfile.lock +++ b/jupyter/trustyai/ubi9-python-3.9/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "160157c8ca0856da6dd43e10d773980e17d25497e426463458e9cf51385d5dc0" + "sha256": "336843943476abb02e536d5004c77d40c77fd6734da93b113ce8d73fb2e23c97" }, "pipfile-spec": 6, "requires": { From 8cf3444a1e4df480354035cc5264fca8af5c64f4 Mon Sep 17 00:00:00 2001 From: Harshad Reddy Nalla Date: Wed, 10 May 2023 03:19:55 -0400 Subject: [PATCH 2/2] Revert the default runtime config setup (#82) - Included the env var KF_PIPELINES_SA_TOKEN_PATH with SA token path Signed-off-by: Harshad Reddy Nalla --- .../ubi8-python-3.8/setup-elyra.sh | 34 +++++++++++++++++++ .../ubi9-python-3.9/setup-elyra.sh | 34 +++++++++++++++++++ 2 files changed, 68 insertions(+) diff --git a/jupyter/datascience/ubi8-python-3.8/setup-elyra.sh b/jupyter/datascience/ubi8-python-3.8/setup-elyra.sh index 7443b6c69..1d96284f0 100644 --- a/jupyter/datascience/ubi8-python-3.8/setup-elyra.sh +++ b/jupyter/datascience/ubi8-python-3.8/setup-elyra.sh @@ -1,6 +1,39 @@ #!/bin/bash set -x +replace_invalid_characters (){ + python -c 'import sys;print(sys.argv[1].translate ({ord(c): "-" for c in "!@#$%^&*()[]{};:,/<>?\|`~=_+"}))' "$1" +} + +# Assumptions are existing kubeflow installation is in the kubeflow namespace +DEFAULT_RUNTIME_FILE=$(jupyter --data-dir)/metadata/runtimes/test.json + +if [ -f "/var/run/secrets/kubernetes.io/serviceaccount/namespace" ]; then + SA_NAMESPACE=$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace) +fi + +COS_BUCKET=$(replace_invalid_characters "$COS_BUCKET") +export COS_BUCKET=${COS_BUCKET:-default} + +# If Kubeflow credentials are not supplied, use default Kubeflow installation credentials +KF_DEPLOYMENT_NAMESPACE="${SA_NAMESPACE:=default}" +AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID:=minio}" +AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY:=minio123}" + +if [[ ! -f "$DEFAULT_RUNTIME_FILE" ]]; then + elyra-metadata install runtimes --schema_name=kfp \ + --name=test \ + --display_name=Test \ + --auth_type=NO_AUTHENTICATION \ + --api_endpoint=http://ml-pipeline."$KF_DEPLOYMENT_NAMESPACE".svc.cluster.local:3000/pipeline \ + --cos_endpoint=http://minio-service."$KF_DEPLOYMENT_NAMESPACE".svc.cluster.local:9000 \ + --cos_auth_type=USER_CREDENTIALS \ + --cos_username="$AWS_ACCESS_KEY_ID" \ + --cos_password="$AWS_SECRET_ACCESS_KEY" \ + --cos_bucket="$COS_BUCKET" \ + --engine=Tekton +fi + # Set the elyra config on the right path cp /opt/app-root/bin/utils/jupyter_elyra_config.py /opt/app-root/src/.jupyter/ @@ -12,3 +45,4 @@ fi # Environment vars set for accessing ssl_sa_certs and sa_token export KF_PIPELINES_SSL_SA_CERTS="/var/run/secrets/kubernetes.io/serviceaccount/ca.crt" export KF_PIPELINES_SA_TOKEN_ENV="/var/run/secrets/kubernetes.io/serviceaccount/token" +export KF_PIPELINES_SA_TOKEN_PATH="/var/run/secrets/kubernetes.io/serviceaccount/token" \ No newline at end of file diff --git a/jupyter/datascience/ubi9-python-3.9/setup-elyra.sh b/jupyter/datascience/ubi9-python-3.9/setup-elyra.sh index 7443b6c69..4da7bded1 100644 --- a/jupyter/datascience/ubi9-python-3.9/setup-elyra.sh +++ b/jupyter/datascience/ubi9-python-3.9/setup-elyra.sh @@ -1,6 +1,39 @@ #!/bin/bash set -x +replace_invalid_characters (){ + python -c 'import sys;print(sys.argv[1].translate ({ord(c): "-" for c in "!@#$%^&*()[]{};:,/<>?\|`~=_+"}))' "$1" +} + +# Assumptions are existing kubeflow installation is in the kubeflow namespace +DEFAULT_RUNTIME_FILE=$(jupyter --data-dir)/metadata/runtimes/test.json + +if [ -f "/var/run/secrets/kubernetes.io/serviceaccount/namespace" ]; then + SA_NAMESPACE=$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace) +fi + +COS_BUCKET=$(replace_invalid_characters "$COS_BUCKET") +export COS_BUCKET=${COS_BUCKET:-default} + +# If Kubeflow credentials are not supplied, use default Kubeflow installation credentials +KF_DEPLOYMENT_NAMESPACE="${SA_NAMESPACE:=default}" +AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID:=minio}" +AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY:=minio123}" + +if [[ ! -f "$DEFAULT_RUNTIME_FILE" ]]; then + elyra-metadata install runtimes --schema_name=kfp \ + --name=test \ + --display_name=Test \ + --auth_type=NO_AUTHENTICATION \ + --api_endpoint=http://ml-pipeline."$KF_DEPLOYMENT_NAMESPACE".svc.cluster.local:3000/pipeline \ + --cos_endpoint=http://minio-service."$KF_DEPLOYMENT_NAMESPACE".svc.cluster.local:9000 \ + --cos_auth_type=USER_CREDENTIALS \ + --cos_username="$AWS_ACCESS_KEY_ID" \ + --cos_password="$AWS_SECRET_ACCESS_KEY" \ + --cos_bucket="$COS_BUCKET" \ + --engine=Tekton +fi + # Set the elyra config on the right path cp /opt/app-root/bin/utils/jupyter_elyra_config.py /opt/app-root/src/.jupyter/ @@ -12,3 +45,4 @@ fi # Environment vars set for accessing ssl_sa_certs and sa_token export KF_PIPELINES_SSL_SA_CERTS="/var/run/secrets/kubernetes.io/serviceaccount/ca.crt" export KF_PIPELINES_SA_TOKEN_ENV="/var/run/secrets/kubernetes.io/serviceaccount/token" +export KF_PIPELINES_SA_TOKEN_PATH="/var/run/secrets/kubernetes.io/serviceaccount/token"