-
Notifications
You must be signed in to change notification settings - Fork 128
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
Added support for s390x and ppc64le for multi-arch image build #956
base: incubation
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @satyamg1620. Thanks for your PR. I'm waiting for a opendatahub-io member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
@zdtsw , can you please add the required reviewers for this PR? |
@satyamg1620 previous 2 auto assigned reviewers were wrongly added, thus I removed them from the list. |
@zdtsw , can you please provide update ? |
Makefile
Outdated
.PHONY: docker-buildx | ||
docker-buildx: ## Build and push docker image for the manager for cross-platform support | ||
# copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile | ||
sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' ./Dockerfiles/Dockerfile > ./Dockerfiles/Dockerfile.cross |
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 you want to replace all ^FROM with FROM --platform=${BUILDPLATFORM} here?
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
Makefile
Outdated
|
||
.PHONY: bundle-docker-buildx | ||
bundle-docker-buildx: ## Build and push docker image for the manager for cross-platform support | ||
# copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile |
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.
Move the recipe to a variable. (Different --tag, so probably, a function)
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 agree to 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.
@ykaliuta Can you please verify the changes as requested?
Makefile
Outdated
PLATFORMS ?= linux/amd64,linux/s390x,linux/ppc64le | ||
.PHONY: docker-buildx | ||
docker-buildx: ## Build and push docker image for the manager for cross-platform support | ||
# copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile |
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 have universal Dockerfile for both types of builds?
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 have tried to use the same Dockerfile for all platform & only use buildx to invoke it with different platform . So Dockerfile is generic. Dockerfile.cross is generated just to handle the platform option passed as a run type argument during buildx command execution. Once its job is done , we are deleting Dockerfile.cross & maintaining only single Dockerfile
Makefile
Outdated
PLATFORMS ?= linux/amd64,linux/s390x,linux/ppc64le | ||
.PHONY: docker-buildx | ||
docker-buildx: ## Build and push docker image for the manager for cross-platform support | ||
# copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile |
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.
Make Dockerfile.cross target and dependency of it.
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.
Since its generated on the fly & removed after execution , i don't understand the use of keeping it as target.
Makefile
Outdated
docker-buildx: ## Build and push docker image for the manager for cross-platform support | ||
# copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile | ||
sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' ./Dockerfiles/Dockerfile > ./Dockerfiles/Dockerfile.cross | ||
- docker buildx create --name project-v3-builder |
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.
Probably makes sense to have BUILDX_BILDER or something.
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.
buildx is an idle solution for multicross platform build & push operation with minimal code change
@ykaliuta can you please review the requested changes? |
3 similar comments
@ykaliuta can you please review the requested changes? |
@ykaliuta can you please review the requested changes? |
@ykaliuta can you please review the requested changes? |
@satyamg1620 Can you please rebase |
@ykaliuta can you please review the requested changes? |
ARG TARGETOS | ||
ARG TARGETARCH |
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 don't need these ARGs here, because they are default one get assigned while building.
# Buildx function for building multi-arch image | ||
define func_buildx | ||
# copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile | ||
sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' $1 > Dockerfile.cross |
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'm wondering instead of this can we feed the platform tag directly into the Dockerfile.cross itself(will not make any difference for the non-buildx flow)
@mkumatag: changing LGTM is restricted to collaborators 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-sigs/prow repository. |
@VaishnaviHire @ykaliuta Is there any plan to approve this PR for multi-arch image |
@zdtsw This pr is till not yet reviewed. can someone review it |
Description
For creating multi-arch build image, use command
make docker-buildx
. For creating bundle build multi-arch image, use commandmake bundle-docker-build
. Above commands build multi-arch images and will push into your provided image registry.How Has This Been Tested?
This has been tested by deploying the build images on openshift cluster and the Opendatahub operator is running up successfully. Our openshift cluster is running upon s390x architecture, so we have used corresponding image generated by the commands provided in Description section. Our changes will not affect other areas of the code. It is just adding support for s390x and ppc64le for multi-arch image build
Merge criteria: