Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions ci/update-kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def get_kubernetes_oss_versions():
"cycle": x["cycle"],
"latest_version": x["latest"],
"eol": get_support_date(x),
"support_source": "OSS Standard Support",
}
for x in data
if has_eol(x)
Expand Down Expand Up @@ -137,6 +138,30 @@ def extend_versions(versions, extended_versions, provider):
f"{provider} support date {extended_version['eol']:%Y-%m-%d}"
)
version["eol"] = extended_version["eol"]
existing_source = version.get(
"support_source", "OSS Standard Support"
)

def format_sources(existing, new):
items = [
s.strip().lstrip("-").strip()
for s in existing.replace("<br>", ",").split(",")
if s.strip()
]
# Add new provider if not already present
if new not in items:
items.append(new)
return " <br> - " + " <br> - ".join(items)
Comment on lines +145 to +154
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function seems out of place. Why is it being defined in here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to add this function as a formatter for displaying the service sources names for any version.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, but defining this as a function within another function is a little strange given that it doesn't require any variables from the scope of the parent function. It would be best to define this at the module level.


if (
"Extended Support" in existing_source
and provider not in existing_source
):
version["support_source"] = format_sources(
existing_source, provider
)
elif existing_source == "OSS Standard Support":
version["support_source"] = f"- {provider} Extended Support"
Comment on lines +156 to +164
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is a little hard to follow, I expect there is a simpler way to implement this. The goal here should be to show which providers are extending the support of each version.

return versions


Expand Down Expand Up @@ -237,6 +262,39 @@ def update_version_support(versions):
Path("kr8s/_constants.py").write_text(version_support)


def update_docs_table(versions, doc_path):
"""Generates and inserts a Markdown table of supported versions into a doc file."""
print(f"Updating support table in {doc_path}...")
doc_path = Path(doc_path)

# 1. Build the Markdown table
table_lines = [
"| Kubernetes Version | Support Until | Source of Support |",
"|--------------------|---------------|-------------------|",
]
for version in versions:
eol_date = version["eol"].strftime("%Y-%m-%d")
source = version.get("support_source", "OSS Standard Support")
table_lines.append(f"| {version['cycle']} | {eol_date} | {source} |")

table = "\n".join(table_lines)

# 2. Read the doc file
content = doc_path.read_text()

# 3. Replace content between markers
new_content = re.sub(
r"(<!-- BEGIN: VERSION_TABLE -->)(.*?)(<!-- END: VERSION_TABLE -->)",
f"\\1\n{table}\n\\3",
content,
flags=re.DOTALL,
)

# 4. Write updated content
doc_path.write_text(new_content)
print("Version support table updated successfully!")


def main():
versions = get_versions()
print(f"Latest version: {versions[0]['cycle']}")
Expand All @@ -253,6 +311,8 @@ def main():
update_badges("README.md", versions)
update_badges("docs/index.md", versions)
update_version_support(versions)
update_docs_table(versions, "docs/version-support.md")

else:
print("DEBUG env var set, skipping file updates")

Expand Down
11 changes: 11 additions & 0 deletions docs/version-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ For each version of Kubernetes we check the following end of life dates:
- [Amazon EKS End of Support](https://endoflife.date/amazon-eks)
- [Azure Kubernetes Service End of Support](https://endoflife.date/azure-kubernetes-service)

<!-- BEGIN: VERSION_TABLE -->
| Kubernetes Version | Support Until | Source of Support |
|--------------------|---------------|-------------------|
| 1.33 | 2027-07-29 | <br> - Azure AKS Extended Support <br> - Amazon EKS |
| 1.32 | 2027-03-31 | - Azure AKS Extended Support |
| 1.31 | 2026-11-30 | - Azure AKS Extended Support |
| 1.30 | 2026-07-31 | - Azure AKS Extended Support |
| 1.29 | 2026-04-30 | - Azure AKS Extended Support |
| 1.28 | 2026-02-28 | - Azure AKS Extended Support |
<!-- END: VERSION_TABLE -->

Once a version has reached end of life from all providers we remove it from our CI/testing matrix.

Typically new versions are released 3-4 times a year and each version receives 12-15 months of support.
Expand Down