From 7aa31a8f6d1d926e2f3d37020f2941ea07ff24fc Mon Sep 17 00:00:00 2001 From: Arcadiy Ivanov Date: Thu, 12 Sep 2024 21:32:12 -0400 Subject: [PATCH] Update Ktor for K8S 1.30/1.31 Change the library selection requirement to capture beta releases without --pre Bump tested versions --- .github/workflows/kubernator.yml | 6 +++--- .idea/kubernator.iml | 2 +- .idea/misc.xml | 2 +- Dockerfile | 2 +- build.py | 3 ++- src/integrationtest/python/full_smoke_tests.py | 2 +- src/integrationtest/python/issue_23_tests.py | 2 +- src/integrationtest/python/test_support.py | 4 ++-- src/main/python/kubernator/api.py | 7 ++++--- 9 files changed, 16 insertions(+), 14 deletions(-) diff --git a/.github/workflows/kubernator.yml b/.github/workflows/kubernator.yml index 86daa77..db1ae20 100644 --- a/.github/workflows/kubernator.yml +++ b/.github/workflows/kubernator.yml @@ -29,7 +29,7 @@ jobs: # - os: macos-12 # python-version: '3.11' env: - DEPLOY_PYTHONS: "3.11" + DEPLOY_PYTHONS: "3.12" DEPLOY_OSES: "Linux" GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} TWINE_USERNAME: __token__ @@ -68,11 +68,11 @@ jobs: set -x brew update brew install docker colima - + colima version colima start --cpu 3 --memory 8 --disk 7 sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock - + while ! docker info > /dev/null 2>&1; do sleep 1 ; done docker info diff --git a/.idea/kubernator.iml b/.idea/kubernator.iml index 84c3a44..96dadcc 100644 --- a/.idea/kubernator.iml +++ b/.idea/kubernator.iml @@ -8,7 +8,7 @@ - + diff --git a/.idea/misc.xml b/.idea/misc.xml index 3545b20..b4e49d5 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -3,7 +3,7 @@ - + diff --git a/Dockerfile b/Dockerfile index b6e5907..ef57f49 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.11-slim-bookworm +FROM python:3.12-slim-bookworm COPY target/dist/kubernator*/dist/*.whl /tmp diff --git a/build.py b/build.py index b83784e..702cf55 100644 --- a/build.py +++ b/build.py @@ -50,7 +50,8 @@ @init def set_properties(project): project.depends_on("gevent", ">=21.1.2") - project.depends_on("kubernetes", "~=29.0") + project.depends_on("kubernetes", "~=30.0") + project.depends_on("durationpy", ">=0.7") project.depends_on("openapi-schema-validator", "~=0.1") project.depends_on("openapi-spec-validator", "~=0.3") project.depends_on("json-log-formatter", "~=0.3") diff --git a/src/integrationtest/python/full_smoke_tests.py b/src/integrationtest/python/full_smoke_tests.py index 1a1467c..1bad576 100644 --- a/src/integrationtest/python/full_smoke_tests.py +++ b/src/integrationtest/python/full_smoke_tests.py @@ -29,7 +29,7 @@ def test_full_smoke(self): test_dir = Path(__file__).parent / "full_smoke" for k8s_version, istio_version in ((self.K8S_TEST_VERSIONS[0], "1.10.6"), - (self.K8S_TEST_VERSIONS[-1], "1.22.0")): + (self.K8S_TEST_VERSIONS[-1], "1.23.1")): with self.subTest(k8s_version=k8s_version, istio_version=istio_version): os.environ["K8S_VERSION"] = k8s_version os.environ["ISTIO_VERSION"] = istio_version diff --git a/src/integrationtest/python/issue_23_tests.py b/src/integrationtest/python/issue_23_tests.py index 04ff417..acc55be 100644 --- a/src/integrationtest/python/issue_23_tests.py +++ b/src/integrationtest/python/issue_23_tests.py @@ -29,7 +29,7 @@ def test_issue_23(self): test_dir = Path(__file__).parent / "issue_23" for k8s_version, istio_version in ((self.K8S_TEST_VERSIONS[0], "1.10.6"), - (self.K8S_TEST_VERSIONS[-1], "1.22.0")): + (self.K8S_TEST_VERSIONS[-1], "1.23.1")): with self.subTest(k8s_version=k8s_version, istio_version=istio_version): os.environ["K8S_VERSION"] = k8s_version os.environ["ISTIO_VERSION"] = istio_version diff --git a/src/integrationtest/python/test_support.py b/src/integrationtest/python/test_support.py index 78e5a31..c442292 100644 --- a/src/integrationtest/python/test_support.py +++ b/src/integrationtest/python/test_support.py @@ -34,8 +34,8 @@ class IntegrationTestSupport(unittest.TestCase): K8S_TEST_VERSIONS = ["1.20.15", "1.21.14", "1.22.17", "1.23.17", "1.24.17", "1.25.16", - "1.26.15", "1.27.14", "1.28.10", - "1.29.5", "1.30.1"] + "1.26.15", "1.27.16", "1.28.13", + "1.29.8", "1.30.4", "1.31.1"] def load_json_logs(self, log_file): decoder = json.JSONDecoder() diff --git a/src/main/python/kubernator/api.py b/src/main/python/kubernator/api.py index ae6e15f..bff7f82 100644 --- a/src/main/python/kubernator/api.py +++ b/src/main/python/kubernator/api.py @@ -38,7 +38,6 @@ import requests import yaml -from platformdirs import user_cache_dir from diff_match_patch import diff_match_patch from jinja2 import (Environment, ChainableUndefined, @@ -46,6 +45,7 @@ Template as JinjaTemplate, pass_context) from jsonschema import validators +from platformdirs import user_cache_dir from kubernator._json_path import jp # noqa: F401 from kubernator._k8s_client_patches import (URLLIB_HEADERS_PATCH, @@ -765,9 +765,10 @@ def install_python_k8s_client(run, package_major, logger, logger_stdout, logger_ if not package_major_dir.exists(): package_major_dir.mkdir(parents=True, exist_ok=True) - run([sys.executable, "-m", "pip", "install", "--no-deps", "--no-input", "--pre", + run([sys.executable, "-m", "pip", "install", "--no-deps", "--no-input", "--root-user-action=ignore", "--break-system-packages", "--disable-pip-version-check", - "--target", package_major_dir_str, f"kubernetes~={package_major}.0"], logger_stdout, logger_stderr).wait() + "--target", package_major_dir_str, f"kubernetes>={package_major!s}dev0,<{int(package_major) + 1!s}"], + logger_stdout, logger_stderr).wait() if not patch_indicator.exists() and not disable_patching: for patch_text, target_file, skip_if_found, min_version, max_version, name in (