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

Add a new directory/remote builder - new modes to specify k8s binaries to build node-images #3614

Merged

Conversation

dims
Copy link
Member

@dims dims commented May 14, 2024

Related to #381

Enabling the following command lines to build node image

  1. Specify a tar gzipped file from a local disk or from an url
kind build node-image $HOME/Downloads/kubernetes-server-linux-amd64.tar.gz
kind build node-image --type url https://dl.k8s.io/v1.30.0/kubernetes-server-linux-arm64.tar.gz

This is aimed at someone who may have a different build system and do not use the k8s make file targets, but would love to build a node image for kind with their own patches and build systems

kind build node-image v1.30.0

This is aimed at the majority of the current requests on slack and other avenues who just want to play with a version we haven't created a node image for (but has an upstream k8s tag and release artifacts)

Please take a look!

Here are the list of files and directory structure needed by the new builder in the tar gzipped file (including the kubernetes directory. which should be at the root of the passed in root directory)

kubernetes
└── server
    └── bin
        ├── kube-apiserver.docker_tag
        ├── kube-apiserver.tar
        ├── kube-controller-manager.tar
        ├── kube-proxy.tar
        ├── kube-scheduler.tar
        ├── kubeadm
        ├── kubectl
        └── kubelet

With this PR, here are some of the possibilities:

kind build node-image https://dl.k8s.io/v1.30.0/kubernetes-server-linux-arm64.tar.gz
kind build node-image $HOME/Downloads/kubernetes-server-linux-amd64.tar.gz
kind build node-image v1.30.0
kind build node-image $HOME/go/src/k8s.io/kubernetes/

kind build node-image --type url https://dl.k8s.io/v1.30.0/kubernetes-server-linux-arm64.tar.gz
kind build node-image --type file $HOME/Downloads/kubernetes-server-linux-amd64.tar.gz
kind build node-image --type release v1.30.0
kind build node-image --type source $HOME/go/src/k8s.io/kubernetes/

kind build node-image

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 14, 2024
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 14, 2024
@dims
Copy link
Member Author

dims commented May 15, 2024

built an image using:

kind build node-image v1.30.0

and looks like that does build the node image properly

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

kubectl cluster-info --context kind-kind

Have a nice day! 👋

$ kubectl cluster-info --context kind-kind
Kubernetes control plane is running at https://127.0.0.1:35929
CoreDNS is running at https://127.0.0.1:35929/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

pkg/build/nodeimage/build.go Outdated Show resolved Hide resolved
@dims dims force-pushed the add-more-ways-to-build-node-image branch 2 times, most recently from 5067065 to 7df6883 Compare May 15, 2024 13:27
pkg/build/nodeimage/build.go Outdated Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
@dims dims force-pushed the add-more-ways-to-build-node-image branch from 7df6883 to 6e0fb3c Compare May 15, 2024 14:15
@dims
Copy link
Member Author

dims commented May 15, 2024

/retest

@dims
Copy link
Member Author

dims commented May 21, 2024

@BenTheElder @aojea here's what i came up with. Please verify if we can go with this.

--type CLI parameter Action
NONE NONE Autodetect k8s directory to build
NONE resolves as a Directory Use directory as source to build
NONE resolves as a tarball file Treat as binary tar ball
NONE parses as a semver Download from dl.k8s.io
NONE parses as a url Download binary tarball
source Directory Use directory as source to build
file tarball file Treat as binary tar ball
release semver Download from dl.k8s.io
url URL to tarball Download binary tarball

@dims dims force-pushed the add-more-ways-to-build-node-image branch from 6e0fb3c to 9755509 Compare May 21, 2024 13:33
@dims
Copy link
Member Author

dims commented May 21, 2024

@stmcginnis @aojea @BenTheElder here are the latest command lines i tested. If these are good, then i'll update the docs in this PR itself.

kind build node-image https://dl.k8s.io/v1.30.0/kubernetes-server-linux-arm64.tar.gz
kind build node-image $HOME/junk/kubernetes-server-linux-amd64.tar.gz
kind build node-image v1.30.0
kind build node-image $HOME/go/src/k8s.io/kubernetes/

kind build node-image --type url https://dl.k8s.io/v1.30.0/kubernetes-server-linux-arm64.tar.gz
kind build node-image --type file ~/junk/kubernetes-server-linux-amd64.tar.gz
kind build node-image --type release v1.30.0
kind build node-image --type source $HOME/go/src/k8s.io/kubernetes/

kind build node-image

@stmcginnis
Copy link
Contributor

This looks reasonable to me - thanks @dims!

@dims dims force-pushed the add-more-ways-to-build-node-image branch 3 times, most recently from d369c8c to 77129f5 Compare May 21, 2024 16:11
@dims
Copy link
Member Author

dims commented May 21, 2024

Updated docs and CLI help. thanks @stmcginnis

@aojea @BenTheElder PTAL

@dims
Copy link
Member Author

dims commented May 21, 2024

We'll want to add a note that modes other than source directory are only kind v0.24+

Done!

@dims dims force-pushed the add-more-ways-to-build-node-image branch from 0f06d1c to b197196 Compare May 21, 2024 23:01
@dims dims changed the title [WIP] Add a new directory/remote builder Add a new directory/remote builder May 21, 2024
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 21, 2024
@dims dims changed the title Add a new directory/remote builder Add a new directory/remote builder - new modes to specify k8s binaries to build node-images May 21, 2024
@dims
Copy link
Member Author

dims commented May 22, 2024

@BenTheElder is VM / VM (Fedora) (docker, rootless) (pull_request) failure a flake? exec format error seems like something wrong in the GH action itself?

@dims dims force-pushed the add-more-ways-to-build-node-image branch from b197196 to 9adb5ec Compare May 22, 2024 02:36
@aojea
Copy link
Contributor

aojea commented May 22, 2024

/lgtm
Thank you very much Dims, this is really great

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 22, 2024
@dims
Copy link
Member Author

dims commented May 22, 2024

Thank you very much Dims, this is really great

thanks @aojea !

/assign @BenTheElder

Copy link
Contributor

@stmcginnis stmcginnis left a comment

Choose a reason for hiding this comment

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

I can see this being very useful!

/lgtm

pkg/build/nodeimage/internal/kube/builder_remote.go Outdated Show resolved Hide resolved
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Co-authored-by: Antonio Ojea <antonio.ojea.garcia@gmail.com>
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
@dims dims force-pushed the add-more-ways-to-build-node-image branch from 9adb5ec to e29f332 Compare May 22, 2024 12:59
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 22, 2024
@stmcginnis
Copy link
Contributor

Thanks @dims!

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 22, 2024
@dims
Copy link
Member Author

dims commented May 22, 2024

/test pull-kind-e2e-kubernetes-1-29

@BenTheElder
Copy link
Member

@BenTheElder is VM / VM (Fedora) (docker, rootless) (pull_request) failure a flake? exec format error seems like something wrong in the GH action itself?

yeah, that sounds like a failed download or bad binfmt_misc, we have some flakes in these jobs with the environment and some flakes in prow with the e2e tests (like #3609, still waiting for those backports to merge)

Copy link
Member

@BenTheElder BenTheElder left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

thanks dims! 🎉

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: BenTheElder, dims

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

The pull request process is described here

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 the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 22, 2024
@k8s-ci-robot k8s-ci-robot merged commit bbcc02f into kubernetes-sigs:main May 22, 2024
29 checks passed
@tanvp112
Copy link

tanvp112 commented Jul 2, 2024

Hi, this is a kind v0.24.0 feature, right? Any thought when this will be release. Thanks!

@BenTheElder
Copy link
Member

It is. When we're ready. There are other essentials to sort out and all of us only work on kind part time so no particular ETA.

you can install kind @ HEAD with the makefile, instructions in the docs, but it won't be fully supported yet and we may make some changes before releasing.

@BenTheElder BenTheElder added this to the v0.24.0 milestone Jul 2, 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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants