-
Notifications
You must be signed in to change notification settings - Fork 247
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
Multi ARCH build amd64, arm64 #698
Conversation
44fb7a4
to
22aeaa1
Compare
@marquiz PTAL, should we try to keep the old structure with build and push command? Should we consider how podman fits into this picture (@ArangoGutierrez)? I think as a start we can keep amd64 and arm64 and then extend if needed. |
/assign marquiz ArangoGutierrez |
Just checked the building would work with podman as eays as:
Podman does a sequential build of each platform supplied:
|
Thanks for working on this @zvonkok! Good questions above. I think it would probably be handy to have separate build targets for building only one image (defaulting to the current os/arch) and all archs, i.e. My test build fails, probably because of some http(s) proxy issue. Need to investigate/fix that:
|
@marquiz What about keeping the old Makefile intact. This enables native builds if you're e.g running on arm64 you do just a make image etc. and those commands would stay the same. Additionally to that we can create as you suggested some new targets for cross builds with buildx. I will push another version soon. |
This keeps the original Makefile almost completely intact, we're adding an include for the multi arch Makefile.
|
Actually we do not need the extra targets. We could simply do:
|
@marquiz Which one do you prefer? |
@ArangoGutierrez Any comments from your side? |
I would only set the Arch, unless we are planning on adding support for non-linux NFD deployments (we don't wanna do there right?) For the rest I like the idea of the ENV VAR
|
@ArangoGutierrez I would leave it as
@marquiz WDYT? |
Hmm, I now took a closer look at this. I don't mind refactoring the existing Makefile. It's not perfect by any means 😇 Looking at this I think that it might be better to have separate Also, I'm not sure how/if the image promotion in https://github.com/kubernetes/k8s.io will work 🧐 Maybe we should build explicit
BTW: shouldn't the GRPC probes be updated? 🤔 A bit unrelated note: if multiarch Any thoughts? |
For mulitarch the image registries support manifest lists so essentially you have one tag that represents several architectures. Depending on the arch you're running on a
will just work. |
We also need a solution to address #563 when doing Multi-Arch builds, I propose not pulling a binary but pulling the source, and compiling during build. |
The quick solution to always get the tip of the master branch like this:
As listed in the grpc-health-probe documentation. |
The longer solution is to have a variable with the version we're interested in and pull from that git tag. |
We definitely want a specific version, for reproducibility, like we currently do. I guess the simplest thing to do is just do:
in the dockerfile |
Issue with gprc probes has been addressed. Also, the image promotion of multiarch images (which I was worried about) is not problem. |
hack/init-buildx.sh
Outdated
@@ -0,0 +1,41 @@ | |||
#!/usr/bin/env bash | |||
# Copyright 2020 The Kubernetes Authors. |
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.
Update year
After cutting v0.10 let's re test |
Makefile
Outdated
@@ -32,7 +32,7 @@ JEKYLL_OPTS := -d '$(SITE_DESTDIR)' $(if $(SITE_BASEURL),-b '$(SITE_BASEURL)',) | |||
|
|||
VERSION := $(shell git describe --tags --dirty --always) | |||
|
|||
IMAGE_REGISTRY ?= k8s.gcr.io/nfd | |||
IMAGE_REGISTRY ?= quay.io/zvonkok |
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.
??
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.
Zvonko secretly moving us to a new world
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'd suggest to change this back to k8s.gcr.io/nfd
😉
Makefile
Outdated
image-all: OUTPUT=--pull | ||
image-all: IMAGE_BUILD_CMD=$(IMAGE_BUILDX_CMD) | ||
image-all: ensure-buildx yamls | ||
$(IMAGE_BUILD_CMD) $(IMAGE_BUILD_ARGS) $(IMAGE_TAG_FULL) |
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 could possibly get rid of the OUTPUT
variable. WDYT?
image-all: OUTPUT=--pull | |
image-all: IMAGE_BUILD_CMD=$(IMAGE_BUILDX_CMD) | |
image-all: ensure-buildx yamls | |
$(IMAGE_BUILD_CMD) $(IMAGE_BUILD_ARGS) $(IMAGE_TAG_FULL) | |
image-all: IMAGE_BUILD_CMD=$(IMAGE_BUILDX_CMD) | |
image-all: ensure-buildx yamls | |
$(IMAGE_BUILD_CMD) $(IMAGE_BUILD_ARGS) $(IMAGE_TAG_FULL) --pull |
Makefile
Outdated
@@ -32,7 +32,7 @@ JEKYLL_OPTS := -d '$(SITE_DESTDIR)' $(if $(SITE_BASEURL),-b '$(SITE_BASEURL)',) | |||
|
|||
VERSION := $(shell git describe --tags --dirty --always) | |||
|
|||
IMAGE_REGISTRY ?= k8s.gcr.io/nfd | |||
IMAGE_REGISTRY ?= quay.io/zvonkok |
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'd suggest to change this back to k8s.gcr.io/nfd
😉
Just confused two parameters, the |
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.
Nice @zvonkok, I think we're almost there 😸
One thing is that it would be nice to get some mention about the multiarch builds in docs/advanced/developer-guide.md
. And document the new variables like IMAGE_BUILDX_CMD
there, too.
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.
Thanks for the update! Few more small comments
And the docs...
docs/advanced/developer-guide.md
Outdated
|
||
|
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.
mdlint hates extra empty lines 😄
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.
Yikes I should take a look at my warnings .... Sorry about that!
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.
One nit to make mdlint happy. Other than that, I think you could squash these into one commit and we could get it merged 👍
/retest |
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.
Could you squash a bit more, one commit should be enough (the second commit Added additional Makefile for mulit arch builds doesn't make much sense) 😉
@marquiz should be good now? :) |
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.
Thanks @zvonkok for the effort! This has been on the wishlist of people for quite some time
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: marquiz, zvonkok 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 |
Sample buildx Makefile for building for various platfroms