From face97b5df499421bdb56407c37a175b032402b8 Mon Sep 17 00:00:00 2001 From: Asaad Balum Date: Tue, 18 Nov 2025 17:07:40 +0200 Subject: [PATCH 1/3] feat: Upgrade Python to 3.12 for CRUD web apps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Upgrade Python toolchain from 3.10 to 3.12 for all three CRUD web applications (Jupyter, Volumes, Tensorboards) and their shared common backend. Changes: - Update Dockerfiles to use python:3.12-slim base image - Add setuptools and wheel installation (required in Python 3.12 slim) - Update CI workflows to use Python 3.12 for testing and linting - Upgrade common backend dependencies to address vulnerabilities: * Flask: 1.1.1 → 2.3.2 * Werkzeug: 0.16.0 → 3.0.6 * requests: 2.22.0 → 2.32.4 * urllib3: 1.25.7 → 2.5.0 * kubernetes: ==22.6.0 → >=22.6.0 Testing performed: - All CI workflows passed (backend unit tests, integration tests, multi-arch builds) - Local functional testing in Kind cluster with full Kubeflow deployment - Verified all three web apps running on Python 3.12 - Tested CRUD operations via UI: * Created, viewed, and deleted Volumes * Created, viewed, and deleted Jupyter Notebooks * Created, viewed, and deleted TensorBoards - Verified namespace visibility and RBAC permissions - Confirmed API endpoints responding correctly - Validated container startup and health checks Closes: #724, #725, #726 Signed-off-by: Asaad Balum --- .github/workflows/jwa_backend_unittests.yaml | 2 +- .github/workflows/python_lint.yaml | 4 ++-- components/crud-web-apps/common/README.md | 4 ++-- .../kubeflow/kubeflow/crud_backend/__init__.py | 2 +- .../kubeflow/kubeflow/crud_backend/config.py | 2 +- .../kubeflow/kubeflow/crud_backend/requirements.txt | 6 ------ components/crud-web-apps/common/backend/setup.py | 13 ++++++------- components/crud-web-apps/jupyter/Dockerfile | 8 +++++--- components/crud-web-apps/jupyter/README.md | 6 +++--- components/crud-web-apps/tensorboards/Dockerfile | 8 +++++--- components/crud-web-apps/tensorboards/README.md | 6 +++--- components/crud-web-apps/volumes/Dockerfile | 8 +++++--- components/crud-web-apps/volumes/README.md | 6 +++--- 13 files changed, 37 insertions(+), 38 deletions(-) delete mode 100644 components/crud-web-apps/common/backend/kubeflow/kubeflow/crud_backend/requirements.txt diff --git a/.github/workflows/jwa_backend_unittests.yaml b/.github/workflows/jwa_backend_unittests.yaml index 184634a7b..933b4d56c 100644 --- a/.github/workflows/jwa_backend_unittests.yaml +++ b/.github/workflows/jwa_backend_unittests.yaml @@ -25,7 +25,7 @@ jobs: - uses: actions/setup-python@v5 with: - python-version: "3.7" + python-version: "3.12" - name: Setup Python environment run: | diff --git a/.github/workflows/python_lint.yaml b/.github/workflows/python_lint.yaml index aa0a60586..034027bd8 100644 --- a/.github/workflows/python_lint.yaml +++ b/.github/workflows/python_lint.yaml @@ -17,10 +17,10 @@ jobs: - name: Checkout source repository uses: actions/checkout@v4 - - name: Set up Python environment 3.8 + - name: Set up Python uses: actions/setup-python@v5 with: - python-version: "3.8" + python-version: "3.12" - name: flake8 Lint uses: py-actions/flake8@v2 diff --git a/components/crud-web-apps/common/README.md b/components/crud-web-apps/common/README.md index 5e33cf788..fc1160673 100644 --- a/components/crud-web-apps/common/README.md +++ b/components/crud-web-apps/common/README.md @@ -45,7 +45,7 @@ In order to build a Docker image and use this code you coud build a wheel and th ```dockerfile ### Docker -FROM python:3.7 AS backend-kubeflow-wheel +FROM python:3.12 AS backend-kubeflow-wheel WORKDIR /src COPY ./components/crud-web-apps/common/backend . @@ -54,7 +54,7 @@ RUN python3 setup.py bdist_wheel ... # Web App -FROM python:3.7 +FROM python:3.12 WORKDIR /package COPY --from=backend-kubeflow-wheel /src . diff --git a/components/crud-web-apps/common/backend/kubeflow/kubeflow/crud_backend/__init__.py b/components/crud-web-apps/common/backend/kubeflow/kubeflow/crud_backend/__init__.py index 9a2356ab2..6f46b0872 100644 --- a/components/crud-web-apps/common/backend/kubeflow/kubeflow/crud_backend/__init__.py +++ b/components/crud-web-apps/common/backend/kubeflow/kubeflow/crud_backend/__init__.py @@ -23,7 +23,7 @@ def create_app(name, static_folder, config): if (config.ENV == BackendMode.DEVELOPMENT.value or config.ENV == BackendMode.DEVELOPMENT_FULL.value): # noqa: W503 - log.warn("RUNNING IN DEVELOPMENT MODE") + log.warning("RUNNING IN DEVELOPMENT MODE") # Register all the blueprints app.register_blueprint(authn_bp) diff --git a/components/crud-web-apps/common/backend/kubeflow/kubeflow/crud_backend/config.py b/components/crud-web-apps/common/backend/kubeflow/kubeflow/crud_backend/config.py index 052999904..c412adc52 100644 --- a/components/crud-web-apps/common/backend/kubeflow/kubeflow/crud_backend/config.py +++ b/components/crud-web-apps/common/backend/kubeflow/kubeflow/crud_backend/config.py @@ -59,7 +59,7 @@ class DevConfig(Config): def __init__(self): super() - log.warn("RUNNING IN DEVELOPMENT MODE") + log.warning("RUNNING IN DEVELOPMENT MODE") class ProdConfig(Config): diff --git a/components/crud-web-apps/common/backend/kubeflow/kubeflow/crud_backend/requirements.txt b/components/crud-web-apps/common/backend/kubeflow/kubeflow/crud_backend/requirements.txt deleted file mode 100644 index 36f7b6f81..000000000 --- a/components/crud-web-apps/common/backend/kubeflow/kubeflow/crud_backend/requirements.txt +++ /dev/null @@ -1,6 +0,0 @@ -Flask==1.1.1 -Flask-API==2.0 -kubernetes==10.0.1 -requests==2.22.0 -urllib3==1.26.18 -Werkzeug==0.16.0 diff --git a/components/crud-web-apps/common/backend/setup.py b/components/crud-web-apps/common/backend/setup.py index d98ba45a4..fa58fe065 100644 --- a/components/crud-web-apps/common/backend/setup.py +++ b/components/crud-web-apps/common/backend/setup.py @@ -1,16 +1,15 @@ import setuptools REQUIRES = [ - "Flask >= 1.1.1", + "Flask >= 2.3.2", "Flask-API >= 2.0", - "kubernetes == 22.6.0", - "requests >= 2.22.0", - "urllib3 >= 1.25.7", - "Werkzeug >= 0.16.0", + "kubernetes >= 22.6.0", + "requests >= 2.32.4", + "urllib3 >= 2.5.0", + "Werkzeug >= 3.0.6", "Flask-Cors >= 3.0.8", "gevent", "prometheus-flask-exporter >= 0.23.1", - "importlib-metadata >= 1.0;python_version<'3.8'", ] setuptools.setup( @@ -27,5 +26,5 @@ "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Libraries :: Python Modules", ], - python_requires=">=3.6", + python_requires=">=3.12", ) diff --git a/components/crud-web-apps/jupyter/Dockerfile b/components/crud-web-apps/jupyter/Dockerfile index 7fd3c169c..bed75fc8b 100644 --- a/components/crud-web-apps/jupyter/Dockerfile +++ b/components/crud-web-apps/jupyter/Dockerfile @@ -1,10 +1,12 @@ # --- Build the backend kubeflow-wheel --- -FROM python:3.10-slim AS backend-kubeflow-wheel +# Python 3.12 upgrade +FROM python:3.12-slim AS backend-kubeflow-wheel WORKDIR /src COPY ./common/backend/ . -RUN python3 setup.py bdist_wheel +RUN pip install --no-cache-dir setuptools wheel && \ + python3 setup.py bdist_wheel # --- Build the frontend kubeflow library --- FROM node:16.20.2-bullseye as frontend-kubeflow-lib @@ -41,7 +43,7 @@ COPY --from=frontend-kubeflow-lib /src/dist/kubeflow/ ./node_modules/kubeflow/ RUN npm run build -- --output-path=./dist/default --configuration=production # Web App -FROM python:3.10-slim +FROM python:3.12-slim WORKDIR /package COPY --from=backend-kubeflow-wheel /src . diff --git a/components/crud-web-apps/jupyter/README.md b/components/crud-web-apps/jupyter/README.md index d32778de6..8071cddae 100644 --- a/components/crud-web-apps/jupyter/README.md +++ b/components/crud-web-apps/jupyter/README.md @@ -32,7 +32,7 @@ with a [configmap](./manifests/base/configs/logos-configmap.yaml) to make it eas Requirements: * node 16.20.2 -* python 3.8 +* python 3.12 ### Frontend @@ -64,8 +64,8 @@ cd components/crud-web-apps/jupyter # create a virtual env and install deps # https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/ -python3.8 -m pip install --user virtualenv -python3.8 -m venv web-apps-dev +python3.12 -m pip install --user virtualenv +python3.12 -m venv web-apps-dev source web-apps-dev/bin/activate # install the deps on the activated virtual env diff --git a/components/crud-web-apps/tensorboards/Dockerfile b/components/crud-web-apps/tensorboards/Dockerfile index bd060c7ca..441f21c32 100644 --- a/components/crud-web-apps/tensorboards/Dockerfile +++ b/components/crud-web-apps/tensorboards/Dockerfile @@ -1,10 +1,12 @@ # --- Build the backend kubeflow-wheel --- -FROM python:3.10-slim AS backend-kubeflow-wheel +# Python 3.12 upgrade +FROM python:3.12-slim AS backend-kubeflow-wheel WORKDIR /src COPY ./common/backend/ . -RUN python3 setup.py bdist_wheel +RUN pip install --no-cache-dir setuptools wheel && \ + python3 setup.py bdist_wheel # --- Build the frontend kubeflow library --- FROM node:16.20.2-bullseye as frontend-kubeflow-lib @@ -41,7 +43,7 @@ COPY --from=frontend-kubeflow-lib /src/dist/kubeflow/ ./node_modules/kubeflow/ RUN npm run build -- --output-path=./dist --configuration=production # Web App -FROM python:3.10-slim +FROM python:3.12-slim WORKDIR /package COPY --from=backend-kubeflow-wheel /src . diff --git a/components/crud-web-apps/tensorboards/README.md b/components/crud-web-apps/tensorboards/README.md index 7a14c84df..f31687cd1 100644 --- a/components/crud-web-apps/tensorboards/README.md +++ b/components/crud-web-apps/tensorboards/README.md @@ -13,7 +13,7 @@ This web app is responsible for allowing the user to manipulate Tensorboard inst Requirements: * node 16.20.2 -* python 3.8 +* python 3.12 ### Frontend @@ -37,8 +37,8 @@ npm run build:watch # create a virtual env and install deps # https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/ cd component/crud-web-apps/tensorboards/backend -python3.8 -m pip install --user virtualenv -python3.8 -m venv web-apps-dev +python3.12 -m pip install --user virtualenv +python3.12 -m venv web-apps-dev source web-apps-dev/bin/activate # install the deps on the activated virtual env diff --git a/components/crud-web-apps/volumes/Dockerfile b/components/crud-web-apps/volumes/Dockerfile index ba6dbbc1d..17dd90b42 100644 --- a/components/crud-web-apps/volumes/Dockerfile +++ b/components/crud-web-apps/volumes/Dockerfile @@ -1,10 +1,12 @@ # --- Build the backend kubeflow-wheel --- -FROM python:3.10-slim AS backend-kubeflow-wheel +# Python 3.12 upgrade +FROM python:3.12-slim AS backend-kubeflow-wheel WORKDIR /src COPY ./common/backend/ . -RUN python3 setup.py bdist_wheel +RUN pip install --no-cache-dir setuptools wheel && \ + python3 setup.py bdist_wheel # --- Build the frontend kubeflow library --- FROM node:16.20.2-bullseye as frontend-kubeflow-lib @@ -41,7 +43,7 @@ COPY --from=frontend-kubeflow-lib /src/dist/kubeflow/ ./node_modules/kubeflow/ RUN npm run build -- --output-path=./dist/default --configuration=production # Web App -FROM python:3.10-slim +FROM python:3.12-slim WORKDIR /package COPY --from=backend-kubeflow-wheel /src . diff --git a/components/crud-web-apps/volumes/README.md b/components/crud-web-apps/volumes/README.md index 701aa53e3..d2fafd367 100644 --- a/components/crud-web-apps/volumes/README.md +++ b/components/crud-web-apps/volumes/README.md @@ -6,7 +6,7 @@ This web app is responsible for allowing the user to manipulate PVCs in their Ku Requirements: * node 16.20.2 -* python 3.8 +* python 3.12 ### Frontend @@ -30,8 +30,8 @@ npm run build:watch # create a virtual env and install deps # https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/ cd component/crud-web-apps/volumes/backend -python3.8 -m pip install --user virtualenv -python3.8 -m venv web-apps-dev +python3.12 -m pip install --user virtualenv +python3.12 -m venv web-apps-dev source web-apps-dev/bin/activate # install the deps on the activated virtual env From 5204943c51f005f975cf501fc560bf0ba04c8fb7 Mon Sep 17 00:00:00 2001 From: Mathew Wicks <5735406+thesuperzapper@users.noreply.github.com> Date: Thu, 27 Nov 2025 10:27:49 -0800 Subject: [PATCH 2/3] mathew: pin `kubernetes` pypi package to `34.1.0` Signed-off-by: Mathew Wicks <5735406+thesuperzapper@users.noreply.github.com> --- components/crud-web-apps/common/backend/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/crud-web-apps/common/backend/setup.py b/components/crud-web-apps/common/backend/setup.py index fa58fe065..643a352fe 100644 --- a/components/crud-web-apps/common/backend/setup.py +++ b/components/crud-web-apps/common/backend/setup.py @@ -3,7 +3,7 @@ REQUIRES = [ "Flask >= 2.3.2", "Flask-API >= 2.0", - "kubernetes >= 22.6.0", + "kubernetes == 34.1.0", "requests >= 2.32.4", "urllib3 >= 2.5.0", "Werkzeug >= 3.0.6", From e7b1f7903f583a6c240bb07c03ef0b577c0d91a5 Mon Sep 17 00:00:00 2001 From: Mathew Wicks <5735406+thesuperzapper@users.noreply.github.com> Date: Thu, 27 Nov 2025 10:40:33 -0800 Subject: [PATCH 3/3] mathew: remove version requirements for `requests` and `urllib3` Signed-off-by: Mathew Wicks <5735406+thesuperzapper@users.noreply.github.com> --- components/crud-web-apps/common/backend/setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/crud-web-apps/common/backend/setup.py b/components/crud-web-apps/common/backend/setup.py index 643a352fe..5e52ef05a 100644 --- a/components/crud-web-apps/common/backend/setup.py +++ b/components/crud-web-apps/common/backend/setup.py @@ -4,8 +4,8 @@ "Flask >= 2.3.2", "Flask-API >= 2.0", "kubernetes == 34.1.0", - "requests >= 2.32.4", - "urllib3 >= 2.5.0", + "requests", + "urllib3", "Werkzeug >= 3.0.6", "Flask-Cors >= 3.0.8", "gevent",