From 4792f3ac136d54e94334ffe3286163cfe9a8dc4e Mon Sep 17 00:00:00 2001 From: Harshad Reddy Nalla Date: Thu, 18 Apr 2024 23:41:50 -0400 Subject: [PATCH] Patch elyra kfp template to fix kfp-kubernetes issue Signed-off-by: Harshad Reddy Nalla --- jupyter/tensorflow/ubi9-python-3.9/Dockerfile | 5 ++++ .../utils/python_dsl_template.patch | 29 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 jupyter/tensorflow/ubi9-python-3.9/utils/python_dsl_template.patch diff --git a/jupyter/tensorflow/ubi9-python-3.9/Dockerfile b/jupyter/tensorflow/ubi9-python-3.9/Dockerfile index 76d8cdffa..31579fdb8 100644 --- a/jupyter/tensorflow/ubi9-python-3.9/Dockerfile +++ b/jupyter/tensorflow/ubi9-python-3.9/Dockerfile @@ -11,11 +11,16 @@ LABEL name="odh-notebook-cuda-jupyter-tensorflow-ubi9-python-3.9" \ io.openshift.build.source-location="https://github.com/opendatahub-io/notebooks/tree/main/jupyter/tensorflow/ubi9-python-3.9" \ io.openshift.build.image="quay.io/opendatahub/workbench-images:cuda-jupyter-tensorflow-ubi9-python-3.9" +COPY utils ./utils/ # Install Python packages and Jupyterlab extensions from Pipfile.lock COPY Pipfile.lock ./ RUN echo "Installing softwares and packages" && micropipenv install && rm -f ./Pipfile.lock +# Temporary:Workaround for fixing the kfp-kubernetes 1.0.0 for elyra pipeline execution +# TODO: Remove this patch once the issue is fixed with kfp-kubernetes upgrade. +RUN patch /opt/app-root/lib/python3.9/site-packages/elyra/templates/kubeflow/v2/python_dsl_template.jinja2 -i utils/python_dsl_template.patch + # Replace Notebook's launcher, "(ipykernel)" with Python's version 3.x.y RUN sed -i -e "s/Python.*/$(python --version | cut -d '.' -f-2)\",/" /opt/app-root/share/jupyter/kernels/python3/kernel.json diff --git a/jupyter/tensorflow/ubi9-python-3.9/utils/python_dsl_template.patch b/jupyter/tensorflow/ubi9-python-3.9/utils/python_dsl_template.patch new file mode 100644 index 000000000..6183736d3 --- /dev/null +++ b/jupyter/tensorflow/ubi9-python-3.9/utils/python_dsl_template.patch @@ -0,0 +1,29 @@ +--- a/python_dsl_template.jinja2 2024-04-18 17:54:08.373533064 -0400 ++++ b/python_dsl_template.jinja2 2024-04-18 18:01:30.152253439 -0400 +@@ -97,9 +97,6 @@ + secret.use_secret_as_env({{ task_name }}, "{{ workflow_task.task_modifiers.object_storage_secret }}", { "AWS_ACCESS_KEY_ID": "AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY": "AWS_SECRET_ACCESS_KEY" }) + {% endif %} + {{ task_name }}.set_display_name("{{ workflow_task.name | string_delimiter_safe }}") +-{% if workflow_task.doc %} +- add_pod_annotation({{ task_name }}, "elyra/node-user-doc","""{{ workflow_task.doc| string_delimiter_safe }}""") +-{% endif %} + {% if workflow_task.task_modifiers.cpu_request %} + {{ task_name }}.set_cpu_request(cpu="{{ workflow_task.task_modifiers.cpu_request }}") + {% endif %} +@@ -126,16 +123,6 @@ + {% if workflow_task.task_modifiers.disable_node_caching %} + {{ task_name }}.execution_options.caching_strategy.max_cache_staleness = "P0D" + {% endif %} +-{% if workflow_task.task_modifiers.pod_labels %} +-{% for pod_label_key, pod_label_value in workflow_task.task_modifiers.pod_labels.items() %} +- add_pod_label({{ task_name }}, "{{ pod_label_key }}", "{{ pod_label_value }}") +-{% endfor %} +-{% endif %} +-{% if workflow_task.task_modifiers.pod_annotations %} +-{% for pod_annotation_key, pod_annotation_value in workflow_task.task_modifiers.pod_annotations.items() %} +- add_pod_annotation({{ task_name }}, "{{ pod_annotation_key }}" , """{{ pod_annotation_value | string_delimiter_safe }}""") +-{% endfor %} +-{% endif %} + {% if workflow_task.task_modifiers.kubernetes_secrets %} + {% for env_var, secret_dict in workflow_task.task_modifiers.kubernetes_secrets.items() %} + secret.use_secret_as_env({{ task_name }}, "{{ secret_dict.name }}", { "{{ secret_dict.key }}" : "{{ env_var }}" })