Skip to content

Commit

Permalink
Removed the example elyra runtime Test from notebook images (#165)
Browse files Browse the repository at this point in the history
Signed-off-by: Harshad Reddy Nalla <[email protected]>
  • Loading branch information
harshad16 authored Aug 16, 2023
1 parent 6f10810 commit 8c0a7e5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 68 deletions.
39 changes: 5 additions & 34 deletions jupyter/datascience/ubi8-python-3.8/setup-elyra.sh
Original file line number Diff line number Diff line change
@@ -1,44 +1,15 @@
#!/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
jupyter elyra --generate-config
cp /opt/app-root/bin/utils/jupyter_elyra_config.py /opt/app-root/src/.jupyter/

# Set runtime config from volume mount
# create the elyra runtime directory if not present
if [ ! -d $(jupyter --data-dir)/metadata/runtimes/ ]; then
mkdir -p $(jupyter --data-dir)/metadata/runtimes/
fi
# Set elyra runtime config from volume mount
if [ "$(ls -A /opt/app-root/runtimes/)" ]; then
cp -r /opt/app-root/runtimes/..data/*.json $(jupyter --data-dir)/metadata/runtimes/
fi
Expand Down
39 changes: 5 additions & 34 deletions jupyter/datascience/ubi9-python-3.9/setup-elyra.sh
Original file line number Diff line number Diff line change
@@ -1,44 +1,15 @@
#!/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
jupyter elyra --generate-config
cp /opt/app-root/bin/utils/jupyter_elyra_config.py /opt/app-root/src/.jupyter/

# Set runtime config from volume mount
# create the elyra runtime directory if not present
if [ ! -d $(jupyter --data-dir)/metadata/runtimes/ ]; then
mkdir -p $(jupyter --data-dir)/metadata/runtimes/
fi
# Set elyra runtime config from volume mount
if [ "$(ls -A /opt/app-root/runtimes/)" ]; then
cp -r /opt/app-root/runtimes/..data/*.json $(jupyter --data-dir)/metadata/runtimes/
fi
Expand Down

0 comments on commit 8c0a7e5

Please sign in to comment.