diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index e8a27bd4..f9a020c7 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -21,8 +21,6 @@ jobs: kubernetes-version: 1.27.3 - python-version: '3.10' kubernetes-version: 1.26.6 - - python-version: '3.10' - kubernetes-version: 1.25.11 env: KUBECONFIG: .pytest-kind/pytest-kind/kubeconfig diff --git a/README.md b/README.md index 403dae2f..9d004cf2 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![Read the Docs](https://img.shields.io/readthedocs/kr8s?logo=readthedocs&logoColor=white)](https://kr8s.readthedocs.io/en/latest/?badge=latest) [![PyPI](https://img.shields.io/pypi/v/kr8s)](https://pypi.org/project/kr8s/) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/kr8s)](https://pypi.org/project/kr8s/) -[![Kubernetes Version Support](https://img.shields.io/badge/Kubernetes%20support-1.25%7C1.26%7C1.27%7C1.28-blue)](https://docs.kr8s.org/en/latest/installation.html#supported-kubernetes-versions) +[![Kubernetes Version Support](https://img.shields.io/badge/Kubernetes%20support-1.26%7C1.27%7C1.28-blue)](https://docs.kr8s.org/en/latest/installation.html#supported-kubernetes-versions) [![PyPI - Wheel](https://img.shields.io/pypi/wheel/kr8s)](https://pypi.org/project/kr8s/) [![PyPI - License](https://img.shields.io/pypi/l/kr8s)](https://pypi.org/project/kr8s/) diff --git a/ci/update-kubernetes.py b/ci/update-kubernetes.py index 94655cb6..a34a4e9c 100755 --- a/ci/update-kubernetes.py +++ b/ci/update-kubernetes.py @@ -25,25 +25,49 @@ def get_versions(): data = [ { "cycle": x["cycle"], - "version": x["latest"], + "latest_version": x["latest"], "eol": datetime.strptime(x["eol"], DATE_FORMAT), } for x in data if datetime.strptime(x["eol"], DATE_FORMAT) > datetime.now() ] data.sort(key=lambda x: x["eol"], reverse=True) - return data + + print("Loading Kubernetes tags from https://hub.docker.com/r/kindest/node/tags...") + with urllib.request.urlopen( + "https://hub.docker.com/v2/repositories/kindest/node/tags" + ) as url: + container_tags = json.load(url) + + for version in data: + try: + version["latest_kind_container"] = [ + x["name"] + for x in container_tags["results"] + if version["cycle"] in x["name"] + ][0][1:] + except IndexError: + version["latest_kind_container"] = None + + before_length = len(data) + print("Pruning versions that do not have a kind release yet...") + data[:] = [x for x in data if x["latest_kind_container"] is not None] + print(f"Pruned {before_length - len(data)} versions") + return data def update_test_workflow(versions): workflow = yaml.load(Path(".github/workflows/test.yaml")) workflow["jobs"]["test"]["strategy"]["matrix"]["kubernetes-version"][0] = versions[ 0 - ]["version"] + ]["latest_kind_container"] workflow["jobs"]["test"]["strategy"]["matrix"]["include"] = [] for version in versions[1:]: workflow["jobs"]["test"]["strategy"]["matrix"]["include"].append( - {"python-version": "3.10", "kubernetes-version": version["version"]} + { + "python-version": "3.10", + "kubernetes-version": version["latest_kind_container"], + } ) yaml.dump(workflow, Path(".github/workflows/test.yaml")) @@ -64,10 +88,12 @@ def update_badges(filename, versions): def main(): versions = get_versions() - print(f"Latest version: {versions[0]['version']}") + print(f"Latest version: {versions[0]['cycle']}") print("Supported versions:") for version in versions: - print(f"{version['version']} until {version['eol']}") + print( + f"For {version['cycle']} using kindest/node {version['latest_kind_container']} until {version['eol']}" + ) update_test_workflow(versions) update_badges("README.md", versions) diff --git a/docs/index.md b/docs/index.md index 237416b8..7718d76a 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2,7 +2,7 @@ [![PyPI](https://img.shields.io/pypi/v/kr8s)](https://pypi.org/project/kr8s/) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/kr8s)](https://pypi.org/project/kr8s/) -[![Kubernetes Version Support](https://img.shields.io/badge/Kubernetes%20support-1.25%7C1.26%7C1.27%7C1.28-blue)](https://docs.kr8s.org/en/latest/installation.html#supported-kubernetes-versions) +[![Kubernetes Version Support](https://img.shields.io/badge/Kubernetes%20support-1.26%7C1.27%7C1.28-blue)](https://docs.kr8s.org/en/latest/installation.html#supported-kubernetes-versions) [![PyPI - Wheel](https://img.shields.io/pypi/wheel/kr8s)](https://pypi.org/project/kr8s/) [![PyPI - License](https://img.shields.io/pypi/l/kr8s)](https://pypi.org/project/kr8s/)