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

Adding multi-platform support for linux/amd64 and linux/arm64 #83

Merged
merged 19 commits into from
Oct 26, 2022

Conversation

cin
Copy link
Contributor

@cin cin commented Oct 17, 2022

Still needs testing as I'm sure I've left something out.

Resolves #81

Craig Ingram added 10 commits October 17, 2022 13:44
Added `--platform` option to `docker build` commands in e2e tests
Added `PLATFORM` variable to Makefile for local builds
Golang version update
Dependency updates

Signed-off-by: Craig Ingram <cingram@us.ibm.com>
Signed-off-by: Craig Ingram <cingram@us.ibm.com>
Signed-off-by: Craig Ingram <cingram@us.ibm.com>
Signed-off-by: Craig Ingram <cingram@us.ibm.com>
Signed-off-by: Craig Ingram <cingram@us.ibm.com>
Problem only shows when updating the kubebuilder-tools
  to 1.25.0 (when the v1beta policy was deprecated)

Signed-off-by: Craig Ingram <cingram@us.ibm.com>
Added podman support for e2d tests

Signed-off-by: Craig Ingram <cingram@us.ibm.com>
Tied to use the `--load` option instead of `--push` but didn't work
May be a Rancher Desktop issue
> error: docker exporter does not currently support exporting manifest lists

Signed-off-by: Craig Ingram <cingram@us.ibm.com>
  `podman buildx` auto-loads the image into the local docker repo
  `podman buildx` doesn't support `--push` arg
  `docker pull` is not necessary with podman
Refactored create_dev_cluster.sh

Signed-off-by: Craig Ingram <cingram@us.ibm.com>
@cin
Copy link
Contributor Author

cin commented Oct 21, 2022

I think this is working, but I don't have a good way of testing the arm images. I've tried building images on a few different configurations as well. I'm using Rancher Desktop on a 2018 Intel based mac, podman on a 2021 m1 mac, and Docker Desktop on WSL under windows. The only issue I'm having is with the images produced by podman. It doesn't have arm64 and amd64 manifests in the image.

# built under WSL with Docker Desktop on Windows 11
❯ docker buildx imagetools inspect us.icr.io/icm-docker-images/varnish-operator:wsl-support
Name:      us.icr.io/icm-docker-images/varnish-operator:wsl-support
MediaType: application/vnd.docker.distribution.manifest.list.v2+json
Digest:    sha256:555238d753bee3066abdf52e76927ea28294b3ad0cd35ad61b54c6e2df7bc4d4

Manifests:
  Name:      us.icr.io/icm-docker-images/varnish-operator:wsl-support@sha256:38de421069d3899c00ca9e04026dedc017596a36d83fd6c2e117543da735fa67
  MediaType: application/vnd.docker.distribution.manifest.v2+json
  Platform:  linux/amd64

  Name:      us.icr.io/icm-docker-images/varnish-operator:wsl-support@sha256:105e783c9c3200ce16e63e66cfaf2ec9969af36f3553b8fdb8eca28a767c452b
  MediaType: application/vnd.docker.distribution.manifest.v2+json
  Platform:  linux/arm64

# built on x86 mac w/Rancher Desktop as Docker Desktop replacement
❯ docker buildx imagetools inspect us.icr.io/icm-docker-images/varnish-operator:arm-support
Name:      us.icr.io/icm-docker-images/varnish-operator:arm-support
MediaType: application/vnd.docker.distribution.manifest.list.v2+json
Digest:    sha256:bd39b9d54fa6ccb46cb57bbc2e9c7368cc67eef182a8fc2c87bc15196d2ec9c0

Manifests:
  Name:      us.icr.io/icm-docker-images/varnish-operator:arm-support@sha256:3174538fe2ca304f658ae11d2057739ae7880d4235da4368c52ed25db69e1870
  MediaType: application/vnd.docker.distribution.manifest.v2+json
  Platform:  linux/arm64

  Name:      us.icr.io/icm-docker-images/varnish-operator:arm-support@sha256:91713a00743b47c194580494a25fefcfd80937b9cc6b385e85e3e49c8304b08a
  MediaType: application/vnd.docker.distribution.manifest.v2+json
  Platform:  linux/amd64

# built on m1 mac with podman
❯ docker buildx imagetools inspect us.icr.io/icm-docker-images/varnish-operator:m1-arm
Name:      us.icr.io/icm-docker-images/varnish-operator:m1-arm
MediaType: application/vnd.oci.image.manifest.v1+json
Digest:    sha256:3ac3ff69aee695fe6a516e676b32aabcf3d393bdcf8a2300fb99306d1bbb69fa

I think the only way I will know if the build works under GHA is to merge/tag it. I'm also having issues on the m1 mac with the e2e-tests. The create script is failing to load the images onto the kind cluster's nodes. This happens with the other images as well, so it's not just an issue with the podman produced images. The e2e-tests work fine under WSL and my old mac.

TLDR: more testing is needed at this point to determine what's going on with the m1 mac and podman.

@cin
Copy link
Contributor Author

cin commented Oct 21, 2022

e2e-tests failure on m1 mac w/podman built images:

+ kind load docker-image -n e2e-tests ibmcom/varnish-operator:local
using podman due to KIND_EXPERIMENTAL_PROVIDER
enabling experimental podman provider
Image: "ibmcom/varnish-operator:local" with ID "01310181d02334a075005a93719350b78e3b80bbf9557b4ef386423a6f0f3cff" not yet present on node "e2e-tests-control-plane", loading...
+ kind load docker-image -n e2e-tests ibmcom/varnish:local
using podman due to KIND_EXPERIMENTAL_PROVIDER
enabling experimental podman provider
Image: "ibmcom/varnish:local" with ID "09c78f243e69900cccf78c18e11eccccf987df349a08ee06eb0c3915f222225d" not yet present on node "e2e-tests-control-plane", loading...
ERROR: failed to load image: command "podman exec --privileged -i e2e-tests-control-plane ctr --namespace=k8s.io images import --digests --snapshotter=overlayfs -" failed with error: exit status 1
Command Output: ctr: image might be filtered out
make: *** [e2e-tests] Error 1

Craig Ingram added 9 commits October 24, 2022 12:35
Added both platforms to docker build commands in e2e-tests

Signed-off-by: Craig Ingram <cingram@us.ibm.com>
Signed-off-by: Craig Ingram <cingram@us.ibm.com>
Signed-off-by: Craig Ingram <cingram@us.ibm.com>
Mainly for testing different platform and build configurations

Signed-off-by: Craig Ingram <cingram@us.ibm.com>
Signed-off-by: Craig Ingram <cingram@us.ibm.com>
Signed-off-by: Craig Ingram <cingram@us.ibm.com>
Signed-off-by: Craig Ingram <cingram@us.ibm.com>
Signed-off-by: Craig Ingram <cingram@us.ibm.com>
Signed-off-by: Craig Ingram <cingram@us.ibm.com>
@cin cin merged commit 3f50ebb into main Oct 26, 2022
@cin cin deleted the 81/arm-support branch October 26, 2022 20:21
@cin cin mentioned this pull request Oct 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build for arm
1 participant