From 7aea969f7d4f9ce64a082a18161a26e1f4c82975 Mon Sep 17 00:00:00 2001 From: Jacob Tomlinson Date: Tue, 5 Nov 2024 09:31:20 -0500 Subject: [PATCH] Fix loading Azure LTS support dates (#515) --- ci/update-kubernetes.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ci/update-kubernetes.py b/ci/update-kubernetes.py index 5e4c9016..ea358317 100755 --- a/ci/update-kubernetes.py +++ b/ci/update-kubernetes.py @@ -43,12 +43,17 @@ def get_azure_aks_versions(): print(f"Loading Azure AKS versions from {url}...") with urllib.request.urlopen(url) as payload: data = json.load(payload) + + # Workaround for https://github.com/kr8s-org/kr8s/issues/514 + # Ensure that the `eol` date is the original date and the`lts` date is the extended date. + for x in data: + if "lts" in x and x["lts"]: + x["eol"], x["lts"] = sorted([x["eol"], x["lts"]]) + data = [ { "cycle": x["cycle"], - "eol": datetime.strptime( - x["eol"] if not x["lts"] else x["support"], DATE_FORMAT - ), + "eol": datetime.strptime(x["eol"], DATE_FORMAT), } for x in data if datetime.strptime(x["eol"], DATE_FORMAT) > datetime.now()