From 6fdc2135e4880bb6c5dbbd75bc3df26f3f925719 Mon Sep 17 00:00:00 2001
From: ChristianZaccaria <christian.zaccaria.cz@gmail.com>
Date: Wed, 16 Oct 2024 12:33:45 +0100
Subject: [PATCH 1/3] Intuit python version for compatible Ray image

---
 .../ray/cluster/generate_yaml.py              | 20 ++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/codeflare_sdk/ray/cluster/generate_yaml.py b/src/codeflare_sdk/ray/cluster/generate_yaml.py
index 0b174650a..83a2f958b 100755
--- a/src/codeflare_sdk/ray/cluster/generate_yaml.py
+++ b/src/codeflare_sdk/ray/cluster/generate_yaml.py
@@ -18,6 +18,7 @@
 """
 
 import json
+import sys
 import typing
 import yaml
 import os
@@ -31,6 +32,11 @@
 )
 import codeflare_sdk
 
+SUPPORTED_PYTHON_VERSIONS = {
+    "3.9": "quay.io/modh/ray@sha256:0d715f92570a2997381b7cafc0e224cfa25323f18b9545acfd23bc2b71576d06",
+    "3.11": "quay.io/modh/ray:2.35.0-py311-cu121",
+}
+
 
 def read_template(template):
     with open(template, "r") as stream:
@@ -88,9 +94,17 @@ def update_names(
 
 def update_image(spec, image):
     containers = spec.get("containers")
-    if image != "":
-        for container in containers:
-            container["image"] = image
+    if not image:
+        python_version = f"{sys.version_info.major}.{sys.version_info.minor}"
+        try:
+            if python_version in SUPPORTED_PYTHON_VERSIONS:
+                image = SUPPORTED_PYTHON_VERSIONS[python_version]
+        except Exception:  # pragma: no cover
+            print(
+                f"Python version '{python_version}' is not supported. Only {', '.join(SUPPORTED_PYTHON_VERSIONS.keys())} are supported."
+            )
+    for container in containers:
+        container["image"] = image
 
 
 def update_image_pull_secrets(spec, image_pull_secrets):

From 8aae7f345c3f8e408cf72325e2e6f452d22ad03c Mon Sep 17 00:00:00 2001
From: ChristianZaccaria <christian.zaccaria.cz@gmail.com>
Date: Thu, 17 Oct 2024 13:43:32 +0100
Subject: [PATCH 2/3] Adjust demo notebooks with new ray image defaults

---
 .../additional-demos/hf_interactive.ipynb     |  8 +++-
 .../additional-demos/local_interactive.ipynb  |  8 +++-
 .../additional-demos/ray_job_client.ipynb     |  8 +++-
 demo-notebooks/guided-demos/0_basic_ray.ipynb |  8 +++-
 .../guided-demos/1_cluster_job_client.ipynb   |  8 +++-
 .../guided-demos/2_basic_interactive.ipynb    |  8 +++-
 .../guided-demos/3_widget_example.ipynb       |  8 +++-
 .../notebook-ex-outputs/0_basic_ray.ipynb     |  8 +++-
 .../1_cluster_job_client.ipynb                |  8 +++-
 .../2_basic_interactive.ipynb                 |  8 +++-
 .../preview_nbs/0_basic_ray.ipynb             |  8 +++-
 .../preview_nbs/1_cluster_job_client.ipynb    |  8 +++-
 .../preview_nbs/2_basic_interactive.ipynb     |  8 +++-
 .../ray/cluster/generate_yaml.py              | 14 +++----
 .../ray/cluster/test_generate_yaml.py         | 38 ++++++++++++++++++-
 15 files changed, 122 insertions(+), 34 deletions(-)

diff --git a/demo-notebooks/additional-demos/hf_interactive.ipynb b/demo-notebooks/additional-demos/hf_interactive.ipynb
index 398359299..d75d96ec8 100644
--- a/demo-notebooks/additional-demos/hf_interactive.ipynb
+++ b/demo-notebooks/additional-demos/hf_interactive.ipynb
@@ -68,8 +68,12 @@
    "source": [
     "Here, we want to define our cluster by specifying the resources we require for our batch workload. Below, we define our cluster object (which generates a corresponding Ray Cluster).\n",
     "\n",
-    "NOTE: 'quay.io/modh/ray:2.35.0-py39-cu121' is the default image used by the CodeFlare SDK for creating a RayCluster resource. \n",
-    "If you have your own Ray image which suits your purposes, specify it in image field to override the default image."
+    "NOTE: The default images used by the CodeFlare SDK for creating a RayCluster resource depend on the installed Python version:\n",
+    "\n",
+    "- For Python 3.9: 'quay.io/modh/ray:2.35.0-py39-cu121'\n",
+    "- For Python 3.11: 'quay.io/modh/ray:2.35.0-py311-cu121'\n",
+    "\n",
+    "If you prefer to use a custom Ray image that better suits your needs, you can specify it in the image field to override the default."
    ]
   },
   {
diff --git a/demo-notebooks/additional-demos/local_interactive.ipynb b/demo-notebooks/additional-demos/local_interactive.ipynb
index a491b97e8..09cb9b89c 100644
--- a/demo-notebooks/additional-demos/local_interactive.ipynb
+++ b/demo-notebooks/additional-demos/local_interactive.ipynb
@@ -35,8 +35,12 @@
    "metadata": {},
    "source": [
     "\n",
-    "NOTE: 'quay.io/modh/ray:2.35.0-py39-cu121' is the default image used by the CodeFlare SDK for creating a RayCluster resource. \n",
-    "If you have your own Ray image which suits your purposes, specify it in image field to override the default image."
+    "NOTE: The default images used by the CodeFlare SDK for creating a RayCluster resource depend on the installed Python version:\n",
+    "\n",
+    "- For Python 3.9: 'quay.io/modh/ray:2.35.0-py39-cu121'\n",
+    "- For Python 3.11: 'quay.io/modh/ray:2.35.0-py311-cu121'\n",
+    "\n",
+    "If you prefer to use a custom Ray image that better suits your needs, you can specify it in the image field to override the default."
    ]
   },
   {
diff --git a/demo-notebooks/additional-demos/ray_job_client.ipynb b/demo-notebooks/additional-demos/ray_job_client.ipynb
index a16ae6e6b..31c5793e4 100644
--- a/demo-notebooks/additional-demos/ray_job_client.ipynb
+++ b/demo-notebooks/additional-demos/ray_job_client.ipynb
@@ -41,8 +41,12 @@
    "metadata": {},
    "source": [
     "\n",
-    "NOTE: 'quay.io/modh/ray:2.35.0-py39-cu121' is the default image used by the CodeFlare SDK for creating a RayCluster resource. \n",
-    "If you have your own Ray image which suits your purposes, specify it in image field to override the default image."
+    "NOTE: The default images used by the CodeFlare SDK for creating a RayCluster resource depend on the installed Python version:\n",
+    "\n",
+    "- For Python 3.9: 'quay.io/modh/ray:2.35.0-py39-cu121'\n",
+    "- For Python 3.11: 'quay.io/modh/ray:2.35.0-py311-cu121'\n",
+    "\n",
+    "If you prefer to use a custom Ray image that better suits your needs, you can specify it in the image field to override the default."
    ]
   },
   {
diff --git a/demo-notebooks/guided-demos/0_basic_ray.ipynb b/demo-notebooks/guided-demos/0_basic_ray.ipynb
index 58a52727b..51fb00268 100644
--- a/demo-notebooks/guided-demos/0_basic_ray.ipynb
+++ b/demo-notebooks/guided-demos/0_basic_ray.ipynb
@@ -47,8 +47,12 @@
    "source": [
     "Here, we want to define our cluster by specifying the resources we require for our batch workload. Below, we define our cluster object (which generates a corresponding RayCluster).\n",
     "\n",
-    "NOTE: 'quay.io/modh/ray:2.35.0-py39-cu121' is the default image used by the CodeFlare SDK for creating a RayCluster resource. \n",
-    "If you have your own Ray image which suits your purposes, specify it in image field to override the default image."
+    "NOTE: The default images used by the CodeFlare SDK for creating a RayCluster resource depend on the installed Python version:\n",
+    "\n",
+    "- For Python 3.9: 'quay.io/modh/ray:2.35.0-py39-cu121'\n",
+    "- For Python 3.11: 'quay.io/modh/ray:2.35.0-py311-cu121'\n",
+    "\n",
+    "If you prefer to use a custom Ray image that better suits your needs, you can specify it in the image field to override the default."
    ]
   },
   {
diff --git a/demo-notebooks/guided-demos/1_cluster_job_client.ipynb b/demo-notebooks/guided-demos/1_cluster_job_client.ipynb
index 05682d823..aaed99304 100644
--- a/demo-notebooks/guided-demos/1_cluster_job_client.ipynb
+++ b/demo-notebooks/guided-demos/1_cluster_job_client.ipynb
@@ -41,8 +41,12 @@
    "source": [
     "Here, we want to define our cluster by specifying the resources we require for our batch workload. Below, we define our cluster object (which generates a corresponding RayCluster).\n",
     "\n",
-    "NOTE: 'quay.io/modh/ray:2.35.0-py39-cu121' is the default image used by the CodeFlare SDK for creating a RayCluster resource. \n",
-    "If you have your own Ray image which suits your purposes, specify it in image field to override the default image."
+    "NOTE: The default images used by the CodeFlare SDK for creating a RayCluster resource depend on the installed Python version:\n",
+    "\n",
+    "- For Python 3.9: 'quay.io/modh/ray:2.35.0-py39-cu121'\n",
+    "- For Python 3.11: 'quay.io/modh/ray:2.35.0-py311-cu121'\n",
+    "\n",
+    "If you prefer to use a custom Ray image that better suits your needs, you can specify it in the image field to override the default."
    ]
   },
   {
diff --git a/demo-notebooks/guided-demos/2_basic_interactive.ipynb b/demo-notebooks/guided-demos/2_basic_interactive.ipynb
index 1612af3f2..8610a0557 100644
--- a/demo-notebooks/guided-demos/2_basic_interactive.ipynb
+++ b/demo-notebooks/guided-demos/2_basic_interactive.ipynb
@@ -44,8 +44,12 @@
    "source": [
     "Once again, let's start by running through the same cluster setup as before:\n",
     "\n",
-    "NOTE: 'quay.io/modh/ray:2.35.0-py39-cu121' is the default image used by the CodeFlare SDK for creating a RayCluster resource. \n",
-    "If you have your own Ray image which suits your purposes, specify it in image field to override the default image."
+    "NOTE: The default images used by the CodeFlare SDK for creating a RayCluster resource depend on the installed Python version:\n",
+    "\n",
+    "- For Python 3.9: 'quay.io/modh/ray:2.35.0-py39-cu121'\n",
+    "- For Python 3.11: 'quay.io/modh/ray:2.35.0-py311-cu121'\n",
+    "\n",
+    "If you prefer to use a custom Ray image that better suits your needs, you can specify it in the image field to override the default."
    ]
   },
   {
diff --git a/demo-notebooks/guided-demos/3_widget_example.ipynb b/demo-notebooks/guided-demos/3_widget_example.ipynb
index 11521ec72..cf0df6ddf 100644
--- a/demo-notebooks/guided-demos/3_widget_example.ipynb
+++ b/demo-notebooks/guided-demos/3_widget_example.ipynb
@@ -47,8 +47,12 @@
    "source": [
     "Here, we want to define our cluster by specifying the resources we require for our batch workload. Below, we define our cluster object (which generates a corresponding RayCluster).\n",
     "\n",
-    "NOTE: 'quay.io/modh/ray:2.35.0-py39-cu121' is the default image used by the CodeFlare SDK for creating a RayCluster resource. \n",
-    "If you have your own Ray image which suits your purposes, specify it in image field to override the default image."
+    "NOTE: The default images used by the CodeFlare SDK for creating a RayCluster resource depend on the installed Python version:\n",
+    "\n",
+    "- For Python 3.9: 'quay.io/modh/ray:2.35.0-py39-cu121'\n",
+    "- For Python 3.11: 'quay.io/modh/ray:2.35.0-py311-cu121'\n",
+    "\n",
+    "If you prefer to use a custom Ray image that better suits your needs, you can specify it in the image field to override the default."
    ]
   },
   {
diff --git a/demo-notebooks/guided-demos/notebook-ex-outputs/0_basic_ray.ipynb b/demo-notebooks/guided-demos/notebook-ex-outputs/0_basic_ray.ipynb
index 3d581e6fb..3e6dc1931 100644
--- a/demo-notebooks/guided-demos/notebook-ex-outputs/0_basic_ray.ipynb
+++ b/demo-notebooks/guided-demos/notebook-ex-outputs/0_basic_ray.ipynb
@@ -47,8 +47,12 @@
    "source": [
     "Here, we want to define our cluster by specifying the resources we require for our batch workload. Below, we define our cluster object (which generates a corresponding RayCluster).\n",
     "\n",
-    "NOTE: 'quay.io/modh/ray:2.35.0-py39-cu121' is the default image used by the CodeFlare SDK for creating a RayCluster resource. \n",
-    "If you have your own Ray image which suits your purposes, specify it in image field to override the default image."
+    "NOTE: The default images used by the CodeFlare SDK for creating a RayCluster resource depend on the installed Python version:\n",
+    "\n",
+    "- For Python 3.9: 'quay.io/modh/ray:2.35.0-py39-cu121'\n",
+    "- For Python 3.11: 'quay.io/modh/ray:2.35.0-py311-cu121'\n",
+    "\n",
+    "If you prefer to use a custom Ray image that better suits your needs, you can specify it in the image field to override the default."
    ]
   },
   {
diff --git a/demo-notebooks/guided-demos/notebook-ex-outputs/1_cluster_job_client.ipynb b/demo-notebooks/guided-demos/notebook-ex-outputs/1_cluster_job_client.ipynb
index 1ccad58cc..e79d47e7a 100644
--- a/demo-notebooks/guided-demos/notebook-ex-outputs/1_cluster_job_client.ipynb
+++ b/demo-notebooks/guided-demos/notebook-ex-outputs/1_cluster_job_client.ipynb
@@ -41,8 +41,12 @@
    "source": [
     "Here, we want to define our cluster by specifying the resources we require for our batch workload. Below, we define our cluster object (which generates a corresponding RayCluster).\n",
     "\n",
-    "NOTE: 'quay.io/modh/ray:2.35.0-py39-cu121' is the default image used by the CodeFlare SDK for creating a RayCluster resource. \n",
-    "If you have your own Ray image which suits your purposes, specify it in image field to override the default image."
+    "NOTE: The default images used by the CodeFlare SDK for creating a RayCluster resource depend on the installed Python version:\n",
+    "\n",
+    "- For Python 3.9: 'quay.io/modh/ray:2.35.0-py39-cu121'\n",
+    "- For Python 3.11: 'quay.io/modh/ray:2.35.0-py311-cu121'\n",
+    "\n",
+    "If you prefer to use a custom Ray image that better suits your needs, you can specify it in the image field to override the default."
    ]
   },
   {
diff --git a/demo-notebooks/guided-demos/notebook-ex-outputs/2_basic_interactive.ipynb b/demo-notebooks/guided-demos/notebook-ex-outputs/2_basic_interactive.ipynb
index 80207c37e..f6417521b 100644
--- a/demo-notebooks/guided-demos/notebook-ex-outputs/2_basic_interactive.ipynb
+++ b/demo-notebooks/guided-demos/notebook-ex-outputs/2_basic_interactive.ipynb
@@ -44,8 +44,12 @@
    "source": [
     "Once again, let's start by running through the same cluster setup as before:\n",
     "\n",
-    "NOTE: 'quay.io/modh/ray:2.35.0-py39-cu121' is the default image used by the CodeFlare SDK for creating a RayCluster resource. \n",
-    "If you have your own Ray image which suits your purposes, specify it in image field to override the default image."
+    "NOTE: The default images used by the CodeFlare SDK for creating a RayCluster resource depend on the installed Python version:\n",
+    "\n",
+    "- For Python 3.9: 'quay.io/modh/ray:2.35.0-py39-cu121'\n",
+    "- For Python 3.11: 'quay.io/modh/ray:2.35.0-py311-cu121'\n",
+    "\n",
+    "If you prefer to use a custom Ray image that better suits your needs, you can specify it in the image field to override the default."
    ]
   },
   {
diff --git a/demo-notebooks/guided-demos/preview_nbs/0_basic_ray.ipynb b/demo-notebooks/guided-demos/preview_nbs/0_basic_ray.ipynb
index 3d581e6fb..3e6dc1931 100644
--- a/demo-notebooks/guided-demos/preview_nbs/0_basic_ray.ipynb
+++ b/demo-notebooks/guided-demos/preview_nbs/0_basic_ray.ipynb
@@ -47,8 +47,12 @@
    "source": [
     "Here, we want to define our cluster by specifying the resources we require for our batch workload. Below, we define our cluster object (which generates a corresponding RayCluster).\n",
     "\n",
-    "NOTE: 'quay.io/modh/ray:2.35.0-py39-cu121' is the default image used by the CodeFlare SDK for creating a RayCluster resource. \n",
-    "If you have your own Ray image which suits your purposes, specify it in image field to override the default image."
+    "NOTE: The default images used by the CodeFlare SDK for creating a RayCluster resource depend on the installed Python version:\n",
+    "\n",
+    "- For Python 3.9: 'quay.io/modh/ray:2.35.0-py39-cu121'\n",
+    "- For Python 3.11: 'quay.io/modh/ray:2.35.0-py311-cu121'\n",
+    "\n",
+    "If you prefer to use a custom Ray image that better suits your needs, you can specify it in the image field to override the default."
    ]
   },
   {
diff --git a/demo-notebooks/guided-demos/preview_nbs/1_cluster_job_client.ipynb b/demo-notebooks/guided-demos/preview_nbs/1_cluster_job_client.ipynb
index 0a2b93431..40195d640 100644
--- a/demo-notebooks/guided-demos/preview_nbs/1_cluster_job_client.ipynb
+++ b/demo-notebooks/guided-demos/preview_nbs/1_cluster_job_client.ipynb
@@ -41,8 +41,12 @@
    "source": [
     "Here, we want to define our cluster by specifying the resources we require for our batch workload. Below, we define our cluster object (which generates a corresponding RayCluster).\n",
     "\n",
-    "NOTE: 'quay.io/modh/ray:2.35.0-py39-cu121' is the default image used by the CodeFlare SDK for creating a RayCluster resource. \n",
-    "If you have your own Ray image which suits your purposes, specify it in image field to override the default image."
+    "NOTE: The default images used by the CodeFlare SDK for creating a RayCluster resource depend on the installed Python version:\n",
+    "\n",
+    "- For Python 3.9: 'quay.io/modh/ray:2.35.0-py39-cu121'\n",
+    "- For Python 3.11: 'quay.io/modh/ray:2.35.0-py311-cu121'\n",
+    "\n",
+    "If you prefer to use a custom Ray image that better suits your needs, you can specify it in the image field to override the default."
    ]
   },
   {
diff --git a/demo-notebooks/guided-demos/preview_nbs/2_basic_interactive.ipynb b/demo-notebooks/guided-demos/preview_nbs/2_basic_interactive.ipynb
index a58c249ef..8838a5bae 100644
--- a/demo-notebooks/guided-demos/preview_nbs/2_basic_interactive.ipynb
+++ b/demo-notebooks/guided-demos/preview_nbs/2_basic_interactive.ipynb
@@ -44,8 +44,12 @@
    "source": [
     "Once again, let's start by running through the same cluster setup as before:\n",
     "\n",
-    "NOTE: 'quay.io/modh/ray:2.35.0-py39-cu121' is the default image used by the CodeFlare SDK for creating a RayCluster resource. \n",
-    "If you have your own Ray image which suits your purposes, specify it in image field to override the default image."
+    "NOTE: The default images used by the CodeFlare SDK for creating a RayCluster resource depend on the installed Python version:\n",
+    "\n",
+    "- For Python 3.9: 'quay.io/modh/ray:2.35.0-py39-cu121'\n",
+    "- For Python 3.11: 'quay.io/modh/ray:2.35.0-py311-cu121'\n",
+    "\n",
+    "If you prefer to use a custom Ray image that better suits your needs, you can specify it in the image field to override the default."
    ]
   },
   {
diff --git a/src/codeflare_sdk/ray/cluster/generate_yaml.py b/src/codeflare_sdk/ray/cluster/generate_yaml.py
index 83a2f958b..01823f1df 100755
--- a/src/codeflare_sdk/ray/cluster/generate_yaml.py
+++ b/src/codeflare_sdk/ray/cluster/generate_yaml.py
@@ -20,6 +20,7 @@
 import json
 import sys
 import typing
+import warnings
 import yaml
 import os
 import uuid
@@ -34,7 +35,7 @@
 
 SUPPORTED_PYTHON_VERSIONS = {
     "3.9": "quay.io/modh/ray@sha256:0d715f92570a2997381b7cafc0e224cfa25323f18b9545acfd23bc2b71576d06",
-    "3.11": "quay.io/modh/ray:2.35.0-py311-cu121",
+    "3.11": "quay.io/modh/ray@sha256:db667df1bc437a7b0965e8031e905d3ab04b86390d764d120e05ea5a5c18d1b4",
 }
 
 
@@ -96,12 +97,11 @@ def update_image(spec, image):
     containers = spec.get("containers")
     if not image:
         python_version = f"{sys.version_info.major}.{sys.version_info.minor}"
-        try:
-            if python_version in SUPPORTED_PYTHON_VERSIONS:
-                image = SUPPORTED_PYTHON_VERSIONS[python_version]
-        except Exception:  # pragma: no cover
-            print(
-                f"Python version '{python_version}' is not supported. Only {', '.join(SUPPORTED_PYTHON_VERSIONS.keys())} are supported."
+        if python_version in SUPPORTED_PYTHON_VERSIONS:
+            image = SUPPORTED_PYTHON_VERSIONS[python_version]
+        else:
+            warnings.warn(
+                f"No default Ray image defined for {python_version}. Please provide your own image or use one of the following python versions: {', '.join(SUPPORTED_PYTHON_VERSIONS.keys())}."
             )
     for container in containers:
         container["image"] = image
diff --git a/src/codeflare_sdk/ray/cluster/test_generate_yaml.py b/src/codeflare_sdk/ray/cluster/test_generate_yaml.py
index 68c6aa89b..606cc950c 100644
--- a/src/codeflare_sdk/ray/cluster/test_generate_yaml.py
+++ b/src/codeflare_sdk/ray/cluster/test_generate_yaml.py
@@ -11,7 +11,9 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-from codeflare_sdk.ray.cluster.generate_yaml import gen_names
+from collections import namedtuple
+import sys
+from .generate_yaml import gen_names, update_image
 import uuid
 
 
@@ -32,3 +34,37 @@ def test_gen_names_without_name(mocker):
     appwrapper_name, cluster_name = gen_names(None)
     assert appwrapper_name.startswith("appwrapper-")
     assert cluster_name.startswith("cluster-")
+
+
+def test_update_image_without_supported_python_version(mocker):
+    # Mock SUPPORTED_PYTHON_VERSIONS
+    mocker.patch.dict(
+        "codeflare_sdk.ray.cluster.generate_yaml.SUPPORTED_PYTHON_VERSIONS",
+        {
+            "3.9": "ray-py3.9",
+            "3.11": "ray-py3.11",
+        },
+    )
+
+    # Create a namedtuple to mock sys.version_info
+    VersionInfo = namedtuple(
+        "version_info", ["major", "minor", "micro", "releaselevel", "serial"]
+    )
+    mocker.patch.object(sys, "version_info", VersionInfo(3, 8, 0, "final", 0))
+
+    # Mock warnings.warn to check if it gets called
+    warn_mock = mocker.patch("warnings.warn")
+
+    # Create a sample spec
+    spec = {"containers": [{"image": None}]}
+
+    # Call the update_image function with no image provided
+    update_image(spec, None)
+
+    # Assert that the warning was called with the expected message
+    warn_mock.assert_called_once_with(
+        "No default Ray image defined for 3.8. Please provide your own image or use one of the following python versions: 3.9, 3.11."
+    )
+
+    # Assert that no image was set in the containers since the Python version is not supported
+    assert spec["containers"][0]["image"] is None

From e9e88c2784d3b57dec4029afd73ec894e54ab12d Mon Sep 17 00:00:00 2001
From: ChristianZaccaria <christian.zaccaria.cz@gmail.com>
Date: Thu, 17 Oct 2024 13:46:19 +0100
Subject: [PATCH 3/3] Remove image from base-template

---
 docs/sphinx/user-docs/cluster-configuration.rst    | 13 +++++++++----
 src/codeflare_sdk/ray/templates/base-template.yaml |  2 --
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/docs/sphinx/user-docs/cluster-configuration.rst b/docs/sphinx/user-docs/cluster-configuration.rst
index 6d27b0f41..238ad51c9 100644
--- a/docs/sphinx/user-docs/cluster-configuration.rst
+++ b/docs/sphinx/user-docs/cluster-configuration.rst
@@ -30,10 +30,15 @@ requirements for creating the Ray Cluster.
    ))
 
 .. note::
-  `quay.io/modh/ray:2.35.0-py39-cu121` is the default image used by
-  the CodeFlare SDK for creating a RayCluster resource. If you have your
-  own Ray image which suits your purposes, specify it in image field to
-  override the default image. If you are using ROCm compatible GPUs you
+  The default images used by the CodeFlare SDK for creating
+  a RayCluster resource depend on the installed Python version:
+
+  - For Python 3.9: `quay.io/modh/ray:2.35.0-py39-cu121`
+  - For Python 3.11: `quay.io/modh/ray:2.35.0-py311-cu121`
+
+  If you prefer to use a custom Ray image that better suits your
+  needs, you can specify it in the image field to override the default.
+  If you are using ROCm compatible GPUs you
   can use `quay.io/modh/ray:2.35.0-py39-rocm61`. You can also find
   documentation on building a custom image
   `here <https://github.com/opendatahub-io/distributed-workloads/tree/main/images/runtime/examples>`__.
diff --git a/src/codeflare_sdk/ray/templates/base-template.yaml b/src/codeflare_sdk/ray/templates/base-template.yaml
index 19e5b1914..b59d2a495 100644
--- a/src/codeflare_sdk/ray/templates/base-template.yaml
+++ b/src/codeflare_sdk/ray/templates/base-template.yaml
@@ -69,7 +69,6 @@ spec:
         containers:
         # The Ray head pod
         - name: ray-head
-          image: quay.io/modh/ray@sha256:0d715f92570a2997381b7cafc0e224cfa25323f18b9545acfd23bc2b71576d06
           imagePullPolicy: Always
           ports:
           - containerPort: 6379
@@ -150,7 +149,6 @@ spec:
       spec:
         containers:
         - name: machine-learning # must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name',  or '123-abc'
-          image: quay.io/modh/ray@sha256:0d715f92570a2997381b7cafc0e224cfa25323f18b9545acfd23bc2b71576d06
           # environment variables to set in the container.Optional.
           # Refer to https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/
           lifecycle: