Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: autogenerate tested k8s versions and centralize config #14176

Merged
merged 4 commits into from
Feb 17, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 4 additions & 3 deletions .devcontainer/pre-build.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#!/usr/bin/env sh
set -eux

# install kubernetes
# install kubernetes using the minimum tested version
K8S_VERSION=$(./hack/k8s-versions.sh | head -n1)
wget -q -O - https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash
k3d cluster get k3s-default || k3d cluster create --image rancher/k3s:v1.29.10-k3s1 --wait
k3d cluster get k3s-default || k3d cluster create --image "rancher/k3s:${K8S_VERSION}-k3s1" --wait
k3d kubeconfig merge --kubeconfig-merge-default

# install kubectl
curl -LO https://dl.k8s.io/release/v1.29.10/bin/linux/$(go env GOARCH)/kubectl
curl -LO "https://dl.k8s.io/release/${K8S_VERSION}/bin/linux/$(go env GOARCH)/kubectl"
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
kubectl cluster-info
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ jobs:
- name: Install and start K3S
run: |
if ! echo "${{ matrix.install_k3s_version }}" | egrep '^v[0-9]+\.[0-9]+\.[0-9]+\+k3s1$'; then
# WARNING: The following line is grepped by hack/k8s-versions.sh, so don't change the format, just the version.
export INSTALL_K3S_VERSION=v1.32.1+k3s1
else
export INSTALL_K3S_VERSION=${{ matrix.install_k3s_version }}
Expand Down
1 change: 1 addition & 0 deletions .spelling
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ liveness
localhost
maxFailures
maxSuccess
md
memoization
memoized
memoizing
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ endif
.PHONY: docs-spellcheck
docs-spellcheck: /usr/local/bin/mdspell docs/metrics.md
# check docs for spelling mistakes
mdspell --ignore-numbers --ignore-acronyms --en-us --no-suggestions --report $(shell find docs -name '*.md' -not -name upgrading.md -not -name README.md -not -name fields.md -not -name upgrading.md -not -name executor_swagger.md -not -path '*/cli/*')
mdspell --ignore-numbers --ignore-acronyms --en-us --no-suggestions --report $(shell find docs -name '*.md' -not -name upgrading.md -not -name README.md -not -name fields.md -not -name upgrading.md -not -name executor_swagger.md -not -path '*/cli/*' -not -name tested-kubernetes-versions.md)
# alphabetize spelling file -- ignore first line (comment), then sort the rest case-sensitive and remove duplicates
$(shell cat .spelling | awk 'NR<2{ print $0; next } { print $0 | "LC_COLLATE=C sort" }' | uniq | tee .spelling > /dev/null)

Expand All @@ -743,7 +743,7 @@ endif
.PHONY: docs-lint
docs-lint: /usr/local/bin/markdownlint docs/metrics.md
# lint docs
markdownlint docs --fix --ignore docs/fields.md --ignore docs/executor_swagger.md --ignore docs/cli --ignore docs/walk-through/the-structure-of-workflow-specs.md
markdownlint docs --fix --ignore docs/fields.md --ignore docs/executor_swagger.md --ignore docs/cli --ignore docs/walk-through/the-structure-of-workflow-specs.md --ignore docs/tested-kubernetes-versions.md

/usr/local/bin/mkdocs:
# update this in Nix when upgrading it here
Expand All @@ -762,6 +762,7 @@ docs: /usr/local/bin/mkdocs \
# check environment-variables.md contains all variables mentioned in the code
./hack/docs/check-env-doc.sh
# build the docs
./hack/docs/supported-versions.sh > docs/tested-kubernetes-versions.md
TZ=UTC mkdocs build --strict
# tell the user the fastest way to edit docs
@echo "ℹ️ If you want to preview your docs, open site/index.html. If you want to edit them with hot-reload, run 'make docs-serve' to start mkdocs on port 8000"
Expand Down
17 changes: 3 additions & 14 deletions docs/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,14 @@ Otherwise, we typically release every two weeks:
* Patch fixes for the current stable version.
* The next RC, if we are currently in a release cycle.

## Kubernetes Compatibility Matrix
## Tested Versions

| Argo Workflows \ Kubernetes | 1.29 | 1.30 | 1.31 | 1.32 |
|-----------------------------|------|------|------|------|
| **main** | `✓` | `✓` | `✓` | `✓` |
| **3.6** | `✓` | `✓` | `✓` | `?` |
| **3.5** | `✓` | `✓` | `?` | `?` |
| **3.4** | `?` | `?` | `?` | `?` |

* `✓` Fully supported versions.
* `?` Due to breaking changes might not work. Also, we haven't thoroughly tested against this version.
* `✕` Unsupported versions.
--8<-- "docs/tested-kubernetes-versions.md"

### Notes on Compatibility

Argo versions may be compatible with newer and older Kubernetes versions (indicated by `?`), but only three minor versions are tested unless otherwise noted.
Argo versions may be compatible with newer and older Kubernetes versions, but only two minor versions are tested.

Note that Kubernetes [is backward compatible with clients](https://github.com/kubernetes/client-go/tree/aa7909e7d7c0661792ba21b9e882f3cd6ad0ce53?tab=readme-ov-file#compatibility-client-go---kubernetes-clusters), so newer k8s versions are generally supported.
The caveats with newer k8s versions are possible changes to experimental APIs and unused new features.
Argo uses stable Kubernetes APIs such as Pods and ConfigMaps; see the Controller and Server RBAC of your [installation](installation.md) for a full list.

The `main` branch is currently [tested on Kubernetes 1.29](https://github.com/argoproj/argo-workflows/blob/main/.github/workflows/ci-build.yaml#L228) and [1.32](https://github.com/argoproj/argo-workflows/blob/main/.github/workflows/ci-build.yaml#L263).
1 change: 1 addition & 0 deletions docs/tested-kubernetes-versions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This page is populated for released Argo Workflows versions. Use the version selector to view this table for a specific version.
Copy link
Member

Choose a reason for hiding this comment

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

Does this mean that we will only generate the table on releases? If that's the case should we manually add the matrix here until the next release is made?

Copy link
Member Author

Choose a reason for hiding this comment

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

Correct, this file will be only be replaced with the table when the Docs workflow is run on release branches. But that doesn't make this message inaccurate, because the release branches will still have old docs containing the Kubernetes Compatibility Matrix table.

Also, using the cherry-pick bot that @Joibel just added (#14151), it should be easy to cherry-pick this onto release-3.6.

28 changes: 28 additions & 0 deletions hack/docs/supported-versions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

set -eu

# Loosely based on https://github.com/argoproj/argo-cd/blob/5b79c34c72300e6e2e6336051ce6992f6d54011c/hack/update-supported-versions.sh

# Extract major/minor versions from branch name, e.g. "release-3.5" will become:
# release-
# 3
# 5
mapfile -t branch_parts < <(git rev-parse --abbrev-ref ${1:-HEAD} | grep -Eo '.*release-|[0-9]')

if [[ -z "${branch_parts[@]}" ]]; then
echo 'This page is populated for released Argo Workflows versions. Use the version selector to view this table for a specific version.'
exit
fi

echo "The following table shows the versions of Kubernetes that are tested with each version of Argo Workflows."
echo
echo "| Argo Workflows version | Kubernetes versions |"
echo "|------------------------|---------------------|"

for n in 0 1 2; do
Copy link
Member

Choose a reason for hiding this comment

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

Why iterate back like this at all? Why not force the user to look at the page for the version they are using instead?

The table for other release numbers may be wrong as an update to k8s version may have occurred on their branch but a release not happened. If we cherry-pick this back to 3.5 then it will iterate back to 3.3 which is even more unsupported than 3.4, and at some point this breaks with a 4.0 release. And at 3.7 release 3.6 will continue to want to document 3.4.

I'd rather we always displayed the "version selector" sentence, and just showed the current branch.

We do lose the version information for main/latest which is probably a healthy thing, so I agree with that.

Copy link
Member Author

Choose a reason for hiding this comment

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

If a user is on an older Kubernetes version and they want to determine what version(s) of Argo Workflows they can use, then a table provides a better user experience than manually switching between versions. But that's probably not common enough to be worth the extra complexity, so I went ahead and rewrote this to only print a single sentence with the tested Kubernetes versions for the current version. That means hack/k8s-versions.sh no longer needs to be compatible with old release branches, so I updated it to be a simple config file that defines the minimum and maximum Kubernetes versions, which is cleaner.

new_version="${branch_parts[1]}.$((branch_parts[2] - n))"
new_branch="${branch_parts[0]}${new_version}"
k8s_versions=$(./hack/k8s-versions.sh "$new_branch" | paste -s | sed 's/\t/, /')
echo "|$new_version|$k8s_versions|"
done
9 changes: 9 additions & 0 deletions hack/k8s-versions.sh
Copy link
Member

Choose a reason for hiding this comment

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

Nice, I like this

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
set -euo pipefail

# For the given revision, extract the Kubernetes versions tested in the
# corresponding e2e-tests CI workflow definition.
# This would be cleaner if we extracted the version data to a separate file,
# but this script is used to generate the "Tested versions" table, so it needs
# to be compatible with old release branches.
git grep -Eh 'INSTALL_K3S_VERSION=|install_k3s_version:' "${1:-HEAD}" -- .github/workflows/ci-build.yaml | grep -o 'v[0-9\.]\+' | sort -u
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ validation:
exclude_docs: |
/proposals/
/requirements.txt
/tested-kubernetes-versions.md

nav:
- Home: README.md
Expand Down