-
Notifications
You must be signed in to change notification settings - Fork 73
🌱 Bump kind to v0.32.0 and rework kindest/node image selection #2744
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
Open
pedjak
wants to merge
1
commit into
operator-framework:main
Choose a base branch
from
pedjak:worktree-bump-kind-and-tilt
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| #!/bin/bash | ||
| set -euo pipefail | ||
| # Regenerates the KIND_IMAGES block in validate_kindest_node.sh | ||
| # by fetching released kindest/node images from the kind GitHub release. | ||
| # | ||
| # Usage: update-kind-images.sh <kind-binary> | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" | ||
| VALIDATE_SCRIPT="${SCRIPT_DIR}/validate_kindest_node.sh" | ||
|
|
||
| KIND="${1:?Usage: $0 <kind-binary>}" | ||
|
|
||
| KIND_VER=$(${KIND} version | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' || true) | ||
| if [ -z "${KIND_VER}" ]; then | ||
| echo "Error: could not determine kind version." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Fetching kindest/node images for kind ${KIND_VER}..." | ||
| RELEASE_BODY=$(curl -sfL "https://api.github.com/repos/kubernetes-sigs/kind/releases/tags/${KIND_VER}") | ||
| IMAGES=$(echo "${RELEASE_BODY}" | grep -oE 'kindest/node:v[0-9]+\.[0-9]+\.[0-9]+' | sort -u || true) | ||
| if [ -z "${IMAGES}" ]; then | ||
| echo "Error: no kindest/node images found for kind ${KIND_VER}." >&2 | ||
| exit 1 | ||
| fi | ||
|
Comment on lines
+19
to
+25
|
||
|
|
||
| TMP=$(mktemp) | ||
| trap 'rm -f "${TMP}"' EXIT | ||
|
|
||
| awk -v ver="${KIND_VER}" -v images="${IMAGES}" \ | ||
| 'BEGIN{in_block=0} | ||
| /^# --- BEGIN KIND IMAGES ---/{print; in_block=1; | ||
| print "# kind " ver | ||
| print "case \"${K8S_MINOR}\" in" | ||
| n=split(images,a,"\n") | ||
| for(i=1;i<=n;i++){if(a[i]=="")continue | ||
| minor=a[i]; sub(/.*:v/,"",minor); sub(/\.[0-9]+$/,"",minor) | ||
| print " " minor ") IMAGE=\"" a[i] "\" ;;"} | ||
| print " *) IMAGE=\"\" ;;" | ||
| print "esac"; next} | ||
| /^# --- END KIND IMAGES ---/{in_block=0; print; next} | ||
| in_block{next} | ||
| {print}' "${VALIDATE_SCRIPT}" > "${TMP}" | ||
|
|
||
| mv "${TMP}" "${VALIDATE_SCRIPT}" | ||
| chmod +x "${VALIDATE_SCRIPT}" | ||
| echo "Updated ${VALIDATE_SCRIPT} with images for kind ${KIND_VER}" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,31 +1,29 @@ | ||
| #!/bin/bash | ||
| # This script verifies that the version of kind used for testing uses a major.minor version of k8s that operator-controller does | ||
| set -euo pipefail | ||
| # Outputs the kindest/node image for the given K8S_VERSION. | ||
| # The KIND_IMAGES block below is regenerated by `make kind-update-images`. | ||
|
|
||
| # Extract the version of kind, by removing the "${GOBIN}/kind-" prefix | ||
| KIND=${KIND#${GOBIN}/kind-} | ||
|
|
||
| GOMODCACHE=$(go env GOMODCACHE) | ||
|
|
||
| REGEX='v[0-9]+\.[0-9]+' | ||
|
|
||
| # Get the version of the image from the local kind build | ||
| if [ -d "${GOMODCACHE}" ]; then | ||
| KIND_VER=$(grep -Eo "${REGEX}" ${GOMODCACHE}/sigs.k8s.io/kind@${KIND}/pkg/apis/config/defaults/image.go) | ||
| if [ -z "${K8S_VERSION:-}" ]; then | ||
| echo "Error: K8S_VERSION is not set." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Get the version of the image from github | ||
| if [ -z "${KIND_VER}" ]; then | ||
| KIND_VER=$(curl -L -s https://github.com/kubernetes-sigs/kind/raw/refs/tags/${KIND}/pkg/apis/config/defaults/image.go | grep -Eo "${REGEX}") | ||
| fi | ||
| K8S_MINOR=$(echo "${K8S_VERSION}" | sed -E 's/^v?([0-9]+\.[0-9]+).*/\1/') | ||
|
|
||
| if [ -z "${KIND_VER}" ]; then | ||
| echo "Unable to determine kindest/node version" | ||
| exit 1 | ||
| fi | ||
| # --- BEGIN KIND IMAGES --- | ||
| # kind v0.32.0 | ||
| case "${K8S_MINOR}" in | ||
| 1.33) IMAGE="kindest/node:v1.33.12" ;; | ||
| 1.34) IMAGE="kindest/node:v1.34.8" ;; | ||
| 1.35) IMAGE="kindest/node:v1.35.5" ;; | ||
| 1.36) IMAGE="kindest/node:v1.36.1" ;; | ||
| *) IMAGE="" ;; | ||
| esac | ||
| # --- END KIND IMAGES --- | ||
|
|
||
| # Compare the versions | ||
| if [ "${KIND_VER}" != "${K8S_VERSION}" ]; then | ||
| echo "kindest/node:${KIND_VER} version does not match k8s ${K8S_VERSION}" | ||
| if [ -z "${IMAGE}" ]; then | ||
| echo "Error: no kindest/node image for k8s ${K8S_MINOR}." >&2 | ||
| echo "Run 'make kind-update-images' after bumping kind." >&2 | ||
| exit 1 | ||
| fi | ||
| exit 0 | ||
| echo "${IMAGE}" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit leery on this. However, it's a github workflow, so it won't impact someone's environment.
Is there no way to tell tilt to use
kind-v0.32.0vskind?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tilt hardcodes
exec.Command("kind", "load", ...)in its source — there's no configuration option to specify a different binary name. The symlink is CI-only and doesn't affect anyone's local environment. The alternative would be installing kind without the version suffix, but that conflicts with how bingo manages tool versions.