Skip to content

add fallback version detection for tarballs < v1.31#3815

Merged
k8s-ci-robot merged 1 commit intokubernetes-sigs:mainfrom
BenTheElder:version-fallback
Dec 10, 2024
Merged

add fallback version detection for tarballs < v1.31#3815
k8s-ci-robot merged 1 commit intokubernetes-sigs:mainfrom
BenTheElder:version-fallback

Conversation

@BenTheElder
Copy link
Copy Markdown
Member

ref #3797

This effectively restores the behavior before #3715 only when we can't get the version file, along with a warning. It will not work with pre-release builds or builds with custom version metadata appended, as before, but it will work with normal upstream tagged stable release builds < v1.31.

For 1.31+ we should continue to use the version file, which will work with pre-release builds and builds with custom build metadata (v1.31.1+foo)

Alternative to #3800

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Dec 10, 2024
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: BenTheElder

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Dec 10, 2024
@BenTheElder
Copy link
Copy Markdown
Member Author

/hold
This is untested and I'm going to circle back later.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 10, 2024
@BenTheElder
Copy link
Copy Markdown
Member Author

BenTheElder commented Dec 10, 2024

Quickly tested with:

# confirm from this PR
$ kind version
kind v0.26.0-alpha.10+23486f390e6347 go1.22.9 linux/amd64

# build 1.30.0 with a tarball URL
$ kind build node-image https://dl.k8s.io/v1.30.0/kubernetes-server-linux-amd64.tar.gz
Detected build type: "url"
Building using URL: "https://dl.k8s.io/v1.30.0/kubernetes-server-linux-amd64.tar.gz"
Starting to build Kubernetes
Downloading "https://dl.k8s.io/v1.30.0/kubernetes-server-linux-amd64.tar.gz"
WARNING: Using fallback version detection due to missing version file (This command works best with Kubernetes v1.31+)
Finished building Kubernetes
Building node image ...
Building in container: kind-build-1733851560-1979951427
Image "kindest/node:latest" build completed.

# confirm cluster works
$ kind create cluster --name=test --image=kindest/node:latest
Creating cluster "test" ...
 ✓ Ensuring node image (kindest/node:latest) 🖼
 ✓ Preparing nodes 📦  
 ✓ Writing configuration 📜 
 ✓ Starting control-plane 🕹️ 
 ✓ Installing CNI 🔌 
 ✓ Installing StorageClass 💾 
Set kubectl context to "kind-test"
You can now use your cluster with:

kubectl cluster-info --context kind-test

Have a nice day! 👋

$ kubectl version
Client Version: v1.30.6-dispatcher
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.30.0

# cleanup
$ kind delete cluster --name=test
Deleting cluster "test" ...
Deleted nodes: ["test-control-plane"]

# build 1.29.4 from a version
$ kind build node-image v1.29.4
Detected build type: "release"
Building using release "v1.29.4" artifacts
Starting to build Kubernetes
Downloading "https://dl.k8s.io/v1.29.4/kubernetes-server-linux-amd64.tar.gz"
WARNING: Using fallback version detection due to missing version file (This command works best with Kubernetes v1.31+)
Finished building Kubernetes
Building node image ...
Building in container: kind-build-1733852026-2066378617
Image "kindest/node:latest" build completed.

# confirm cluster works
$ kind create cluster --name=test --image=kindest/node:latest
Creating cluster "test" ...
 ✓ Ensuring node image (kindest/node:latest) 🖼
 ✓ Preparing nodes 📦  
 ✓ Writing configuration 📜 
 ✓ Starting control-plane 🕹️ 
 ✓ Installing CNI 🔌 
 ✓ Installing StorageClass 💾 
Set kubectl context to "kind-test"
You can now use your cluster with:

kubectl cluster-info --context kind-test

Have a nice day! 👋

$ kubectl version
Client Version: v1.29.10
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.29.4

$ kind delete cluster --name=test
Deleting cluster "test" ...
Deleted nodes: ["test-control-plane"]

# build with 1.31.0+
$ kind build node-image v1.31.0
Detected build type: "release"
Building using release "v1.31.0" artifacts
Starting to build Kubernetes
Downloading "https://dl.k8s.io/v1.31.0/kubernetes-server-linux-amd64.tar.gz"
Finished building Kubernetes
Building node image ...
Building in container: kind-build-1733852209-1132115696
Image "kindest/node:latest" build completed.

@BenTheElder
Copy link
Copy Markdown
Member Author

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 10, 2024
Comment thread pkg/build/nodeimage/internal/kube/builder_tarball.go
@BenTheElder BenTheElder added this to the v0.26.0 milestone Dec 10, 2024
@stmcginnis
Copy link
Copy Markdown
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 10, 2024
@k8s-ci-robot k8s-ci-robot merged commit f72c0ee into kubernetes-sigs:main Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants