Add Astarte Operator compatibility matrix#3840
Conversation
Soffi AI SummaryThis PR extends the platform's Kubernetes add-on compatibility matrix coverage by adding the Astarte Kubernetes Operator as a tracked application. The motivation is to allow Console to surface Kubernetes version compatibility information for Astarte Operator installations, consistent with how it tracks other operators and add-ons in Three artifacts are introduced:
The second commit tightened the scraper implementation based on review feedback (improved version normalization, series-specificity logic, and error handling). Commits
Updated: 2026-07-13 14:16 UTC |
Greptile SummaryThis PR adds Astarte Kubernetes Operator to the compatibility matrix, contributing a static YAML file, a scraper, and a manifest entry.
Confidence Score: 3/5The static YAML and manifest registration are safe to merge; the scraper has two bugs that would cause it to crash rather than produce useful output. The scraper will throw an uncaught ValueError whenever the docs page contains a table that matches the two validated headers but lacks the Astarte Version column. A separate crash path exists when the KUBE_VERSION file is absent and current_kube_version() returns None, which is passed straight into expand_kube_versions. Both failures happen silently without a clean error message. utils/compatibility/scrapers/astarte-operator.py needs attention for the two crash paths; the static YAML and manifest are fine.
|
| Filename | Overview |
|---|---|
| utils/compatibility/scrapers/astarte-operator.py | New scraper for Astarte Operator: _find_compatibility_table validates only 2 of the 3 required column headers, so _parse_compatibility_rows will throw ValueError if "Astarte Version" is absent; also passes potentially-None return from current_kube_version() to expand_kube_versions. |
| static/compatibilities/astarte-operator.yaml | New compatibility matrix for Astarte Operator with 5 version entries; chart_version 22.11.01 has a leading zero in the patch field. |
| static/compatibilities/manifest.yaml | Adds astarte-operator as the first entry in the names list; registration looks correct. |
Reviews (1): Last reviewed commit: "Add Astarte Operator compatibility matri..." | Re-trigger Greptile
| for table in soup.find_all("table"): | ||
| headers = [th.get_text(" ", strip=True) for th in table.find_all("th")] | ||
| if "Astarte Operator Version" in headers and "Kubernetes Version" in headers: | ||
| return table, headers | ||
| return None, [] |
There was a problem hiding this comment.
_find_compatibility_table only validates that "Astarte Operator Version" and "Kubernetes Version" appear in the headers, but _parse_compatibility_rows unconditionally calls headers.index("Astarte Version"). If the docs page ever renders a table that matches the first two columns but lacks the "Astarte Version" column (renamed, merged, or split), the scraper crashes with an uncaught ValueError instead of reporting a clean error and exiting.
| for table in soup.find_all("table"): | |
| headers = [th.get_text(" ", strip=True) for th in table.find_all("th")] | |
| if "Astarte Operator Version" in headers and "Kubernetes Version" in headers: | |
| return table, headers | |
| return None, [] | |
| for table in soup.find_all("table"): | |
| headers = [th.get_text(" ", strip=True) for th in table.find_all("th")] | |
| if ( | |
| "Astarte Operator Version" in headers | |
| and "Astarte Version" in headers | |
| and "Kubernetes Version" in headers | |
| ): | |
| return table, headers | |
| return None, [] |
| def _parse_min_kube(value: str) -> list[str]: | ||
| match = re.search(r"v?(\d+\.\d+)\+", value) | ||
| if not match: | ||
| return [] | ||
| return expand_kube_versions(match.group(1), current_kube_version()) |
There was a problem hiding this comment.
current_kube_version() returns None when the KUBE_VERSION file is missing (e.g., on a fresh checkout). Passing None as the second argument to expand_kube_versions causes NoneType.split(".") to raise AttributeError, crashing every row parse silently before any useful error message is printed.
| def _parse_min_kube(value: str) -> list[str]: | |
| match = re.search(r"v?(\d+\.\d+)\+", value) | |
| if not match: | |
| return [] | |
| return expand_kube_versions(match.group(1), current_kube_version()) | |
| def _parse_min_kube(value: str) -> list[str]: | |
| match = re.search(r"v?(\d+\.\d+)\+", value) | |
| if not match: | |
| return [] | |
| end = current_kube_version() | |
| if not end: | |
| print_error("KUBE_VERSION not available; cannot expand kube versions.") | |
| return [] | |
| return expand_kube_versions(match.group(1), end) |
| - version: 22.11.1 | ||
| kube: ['1.35', '1.34', '1.33', '1.32', '1.31', '1.30', '1.29', '1.28', '1.27', '1.26', | ||
| '1.25', '1.24', '1.23', '1.22'] | ||
| chart_version: 22.11.01 |
There was a problem hiding this comment.
The
chart_version for 22.11.1 is 22.11.01 — a non-standard semver with a leading zero in the patch field. While packaging.version normalises this to 22.11.1 when sorting, the scraper passes the raw string to helm template --version 22.11.01, and Helm also accepts it. However, sort_versions in utils.py calls Version(v["chart_version"]) which silently normalises the string, meaning the next scraper run will write back 22.11.1, losing the original 22.11.01. Normalising it now avoids the silent drift.
| chart_version: 22.11.01 | |
| chart_version: 22.11.1 |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
This seems like a cool project, but I don't think it has enough realistic usage to justify adding to our common set. |
Summary
Adds Astarte Kubernetes Operator to the compatibility matrix coverage.
static/compatibilities/astarte-operator.yamlutils/compatibility/scrapers/astarte-operator.pyastarte-operatorinstatic/compatibilities/manifest.yamlSources
Test Plan
python -m py_compile utils/compatibility/scrapers/astarte-operator.pystatic/compatibilities/astarte-operator.yamlandstatic/compatibilities/manifest.yamlwithyaml.safe_loadupdate_compatibility_infostubbed to verify it extracts versions and chart versions from the official docs and Helm indexgit diff --checkI did not run the full compatibility update locally because this machine does not have
helminstalled, andupdate_compatibility_infoshells out tohelm templateto collect chart images.Checklist
This contribution follows the compatibility bounty guidance in the repository README for a new application plus scraper.