-
Notifications
You must be signed in to change notification settings - Fork 346
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
Add support for building local kind Node image #6399
base: main
Are you sure you want to change the base?
Conversation
.github/workflows/conformance.yml
Outdated
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64 | ||
chmod +x ./kind | ||
sudo mv kind /usr/local/bin | ||
- name: Prepare local Machine for Conformance test | ||
run: | | ||
if [ "${{ inputs.k8s-version }}" != "latest" ]; then |
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.
We should support both branch and tags like 'v1.30.0-rc.0', 'v1.31.0-alpha.0' from K8s repo. The purpose to build local Kind image is to run comformance test against the latest one or different release candidates.
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.
Got it, replaced this if condition with a regex.
ci/kind/kind-setup.sh
Outdated
# When k8s-version is "latest", build node image with the latest k8s version | ||
if [[ "$K8S_VERSION" == "latest" ]]; then | ||
echo "=== Building kind node image with the latest k8s version ===" | ||
kind_node_image="kindest/node:latest" |
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.
# When k8s-version is "latest", build node image with the latest k8s version | |
if [[ "$K8S_VERSION" == "latest" ]]; then | |
echo "=== Building kind node image with the latest k8s version ===" | |
kind_node_image="kindest/node:latest" | |
# When k8s-version is "latest", build node image with the latest K8s version | |
if [[ "$K8S_VERSION" == "latest" ]]; then | |
echo "=== Building Kind node image with the latest K8s version ===" | |
kind_node_image="kindest/node:latest" |
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.
Done.
.github/workflows/conformance.yml
Outdated
conformance_image_options=() | ||
# If the K8s version is 'latest', we need to find the latest conformance image. | ||
if [ ${{ inputs.k8s-version == 'latest' }} ]; then | ||
conformance_image_options+=(--conformance-image "registry.k8s.io/conformance:$(skopeo list-tags docker://registry.k8s.io/conformance | jq -r '.Tags[]' | sort -V | tail -n 1)") |
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.
conformance_image_options+=(--conformance-image "registry.k8s.io/conformance:$(skopeo list-tags docker://registry.k8s.io/conformance | jq -r '.Tags[]' | sort -V | tail -n 1)") | |
latest_tag=$(skopeo list-tags docker://registry.k8s.io/conformance | jq -r '.Tags[]' | sort -V | tail -n 1) | |
# Add the conformance image option | |
conformance_image_options+=(--conformance-image "registry.k8s.io/conformance:$latest_tag") |
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.
Changed, thanks for then comment.
ci/kind/kind-setup.sh
Outdated
@@ -665,6 +666,14 @@ if version_lt "$kind_version" "0.12.0" && [[ "$KUBE_PROXY_MODE" == "none" ]]; th | |||
exit 1 | |||
fi | |||
|
|||
# When k8s-version is not vx.y.z, we need to build the K8s node image in local. | |||
if [[ ! $K8S_VERSION =~ ^(v)?[0-9]+\.[0-9]+\.[0-9]+$ ]]; then |
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.
Do it mean we can only support local K8s node image building when the K8s version like v1.30.0-alpha, v1.31.0-rc1?
How do we support a future version like v1.31.0 when the Kind haven't supported it yet in its release?
For example, Kind 0.23 only supports following images by default:
https://github.com/kubernetes-sigs/kind/releases/tag/v0.23.0
Images pre-built for this release:
v1.30.0: kindest/node:v1.30.0@sha256:047357ac0cfea04663786a612ba1eaba9702bef25227a794b52890dd8bcd692e
v1.29.4: kindest/node:v1.29.4@sha256:3abb816a5b1061fb15c6e9e60856ec40d56b7b52bcea5f5f1350bc6e2320b6f8
v1.28.9: kindest/node:v1.28.9@sha256:dca54bc6a6079dd34699d53d7d4ffa2e853e46a20cd12d619a09207e35300bd0
v1.27.13: kindest/node:v1.27.13@sha256:17439fa5b32290e3ead39ead1250dca1d822d94a10d26f1981756cd51b24b9d8
v1.26.15: kindest/node:v1.26.15@sha256:84333e26cae1d70361bb7339efb568df1871419f2019c80f9a12b7e2d485fe19
v1.25.16: kindest/node:v1.25.16@sha256:5da57dfc290ac3599e775e63b8b6c49c0c85d3fec771cd7d55b45fae14b38d3b
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.
Yes, we cannot guarantee Kind will release the latest K8s Node, so I used docker pull
command to check whether the Node image exists or not. If not, then we will try to build image in local.
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.
LGTM overall, two nits
@hjiajing please update the PR details info. |
When trigger Manually upstream conformance test on Linux, if the input kubernetes version has no corresponding kind Node image, the job will build kind Node image with the Kubernetes source code. Signed-off-by: Jiajing Hu <hjiajing@vmware.com>
When triggering Manually upstream conformance test on Linux, if the input kubernetes version is "latest", the job will build kind Node image with the latest Kubernetes source code, and create Kind Cluster with local Node image.