-
Notifications
You must be signed in to change notification settings - Fork 280
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
chore: adopt buildx bake when building container images #1145
chore: adopt buildx bake when building container images #1145
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: MartinForReal 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 |
/assign @nilo19 |
/cc @lodrem |
@MartinForReal: GitHub didn't allow me to request PR reviews from the following users: lodrem. Note that only kubernetes-sigs members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
buildx-setup: | ||
docker buildx inspect img-builder > /dev/null || docker buildx create --name img-builder --use | ||
# enable qemu for arm64 build | ||
# https://github.com/docker/buildx/issues/464#issuecomment-741507760 | ||
docker run --privileged --rm tonistiigi/binfmt --uninstall qemu-aarch64 | ||
docker run --rm --privileged tonistiigi/binfmt --install all | ||
|
||
.PHONY: build-ccm-image | ||
build-ccm-image: buildx-setup docker-pull-prerequisites ## Build controller-manager image. |
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 we keep this or refine it to build for the specified arch/platform? The internal pipeline may depend on this (build and export to tar).
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.
build-ccm-image-% target is added. e.g make build-ccm-image-amd64
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.
same case for cnm, and we already use the following syntax to build cnm to mcr.
OUTPUT_TYPE="docker,dest=$mydir/azure-cloud-node-manager.tar" ARCH=$(arch) make build-node-image-linux
buildx-bake.hcl
Outdated
} | ||
|
||
group "default" { | ||
targets = ["ccm-amd64","ccm-arm64","ccm-arm","cnm-amd64","cnm-arm64","cnm-arm"] |
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 this also support the Windows targets?
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.
sure
/cc @AbelHu |
@MartinForReal: GitHub didn't allow me to request PR reviews from the following users: AbelHu. Note that only kubernetes-sigs members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/assign @feiskyer |
/cc @mainred |
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 introducing buildx baker
, left several comments.
buildx-setup: | ||
docker buildx inspect img-builder > /dev/null || docker buildx create --name img-builder --use | ||
# enable qemu for arm64 build | ||
# https://github.com/docker/buildx/issues/464#issuecomment-741507760 | ||
docker run --privileged --rm tonistiigi/binfmt --uninstall qemu-aarch64 | ||
docker run --rm --privileged tonistiigi/binfmt --install all | ||
|
||
.PHONY: build-ccm-image | ||
build-ccm-image: buildx-setup docker-pull-prerequisites ## Build controller-manager image. |
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.
same case for cnm, and we already use the following syntax to build cnm to mcr.
OUTPUT_TYPE="docker,dest=$mydir/azure-cloud-node-manager.tar" ARCH=$(arch) make build-node-image-linux
Makefile
Outdated
|
||
build-ccm-image-%: | ||
ENABLE_GIT_COMMAND="$(ENABLE_GIT_COMMAND)" VERSION="$(VERSION)" OUTPUT=registry docker buildx bake --pull --progress plain -f buildx-bake.hcl ccm-$* |
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.
ditto and same for the build-cnm-image-% you are going to add.
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.
It works.
/retest |
1 similar comment
/retest |
|
||
.PHONY: build-node-image-linux | ||
build-node-image-linux: buildx-setup |
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.
OUTPUT_TYPE="docker,dest=$(image.release.dir)/linux/$(arch)/azure-cloud-node-manager.tar" ARCH=$(arch) make build-node-image-linux
is used to build cnm with specific arch, can we support this?
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.
IMAGE_REGISTRY=martindlut OUTPUT=registry make build-node-image-linux can be used to build image for all platform.
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.
Is it possible to build arm64 cnm image alone? Through the buildx baker target you provided "cnm-linux-amd64","cnm-linux-arm64","cnm-linux-arm",
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.
try build-node-image-linux
/retest |
Signed-off-by: MartinForReal <[email protected]>
|
||
.PHONY: build-node-image-linux | ||
build-node-image-linux: buildx-setup | ||
ENABLE_GIT_COMMAND="$(ENABLE_GIT_COMMAND)" VERSION="$(VERSION)" OUTPUT="$(OUTPUT_TYPE)" IMAGE_TAG="$(IMAGE_TAG)" docker buildx bake --pull --progress plain -f buildx-bake.hcl cnm-linux-amd64 |
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.
docker buildx bake --pull --progress plain -f buildx-bake.hcl cnm-linux-amd64
, -amd64?
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, It is amd64 only
tags = [ | ||
"${IMAGE_REGISTRY}/azure-cloud-node-manager:${IMAGE_TAG}-windows-ltsc2022-amd64" | ||
] | ||
} |
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.
nit: an empty line here.
/test pull-cloud-provider-azure-e2e-ccm-capz |
1 similar comment
/test pull-cloud-provider-azure-e2e-ccm-capz |
🐛 Handle pointer to alias in DeepCopy
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
adopt buildx bake to boost image building process
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
May introduce regression to e2e tests.
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: