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

feat: linux/arm64 compatibility #319

Merged
merged 1 commit into from
Jun 27, 2024

Conversation

isometry
Copy link
Contributor

No description provided.

@kollabpr
Copy link
Contributor

kollabpr commented May 7, 2024

Hi @isometry, Thanks for the feature request and the PR! We will review with the team and get back to you soon.

@dcamzn
Copy link

dcamzn commented May 8, 2024

Thank you. We plan to support ARM this year, however, it doesn't look like we can deliver ARM support in Q2.

@isometry
Copy link
Contributor Author

isometry commented May 9, 2024

Thank you. We plan to support ARM this year, however, it doesn't look like we can deliver ARM support in Q2.

What more is needed beyond the changes in this PR? Can we help?

@jtackaberry
Copy link

What more is needed beyond the changes in this PR?

I imagine they might want a better integrated solution? Your PR understandably makes efforts to be non-invasive and low risk (by creating a temporary hacked version of the Dockerfile), but IMO a proper solution would just have a working Dockerfile in all cases.

In any case @isometry I tried your patch but the arm64 images aren't actually working on arm64. Classic "exec format error" on execution.

This is because of docker/buildx#510 and I needed to make this change to the Dockerfile to get a proper build:

diff --git a/Dockerfile b/Dockerfile
index 7288a6b..533705f 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -2,8 +2,8 @@
 FROM golang:1.21 as builder
 WORKDIR /workspace

-ARG TARGETARCH=amd64
-ARG TARGETOS=linux
+ARG TARGETARCH
+ARG TARGETOS

 ENV GOPROXY=direct
 # Copy the Go Modules manifests
@@ -18,8 +18,8 @@ COPY main.go main.go
 COPY pkg/ pkg/

 ENV CGO_ENABLED=0
-ENV GOOS=$TARGETOS
-ENV GOARCH=$TARGETARCH
+ENV GOOS=${TARGETOS:-linux}
+ENV GOARCH=${TARGETARCH:-amd64}
 ENV GO111MODULE=on

@isometry
Copy link
Contributor Author

isometry commented Jun 12, 2024

Thanks @jtackaberry! The Dockerfile hack is what operator-sdk is currently pushing (IIRC). I personally favour building a minimalist image with ko. My initial local patch actually included your fixes but I reverted in a misguided attempt to minimise the footprint of the patch after seeing other operators using the original pattern. Oh well. I'll update :-)

@isometry isometry force-pushed the feature/arm64-compat branch 2 times, most recently from b5323b5 to 4c452bf Compare June 12, 2024 21:05
@isometry
Copy link
Contributor Author

isometry commented Jun 12, 2024

@jtackaberry : as per your suggestion, I've tidied up to remove unnecessary shenanigans.
The result is available at ghcr.io/isometry/aws-privateca-issuer:latest for testing.

@isometry isometry force-pushed the feature/arm64-compat branch from 4c452bf to 54b818f Compare June 13, 2024 20:16
@bmsiegel bmsiegel mentioned this pull request Jun 25, 2024
@@ -1,9 +1,9 @@
# Build the manager binary
FROM golang:1.22 as builder
FROM --platform=${BUILDPLATFORM} golang:1.22 as builder
Copy link
Contributor

Choose a reason for hiding this comment

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

"BUILDPLATFORM is part of a set of automatically defined (global scope) build arguments that you can use. It will always match the platform or your current system and the builder will fill in the correct value for us."

from: https://www.docker.com/blog/faster-multi-platform-builds-dockerfile-cross-compilation-guide/

Putting this here for reference

Fixes: cert-manager#283

Signed-off-by: Robin Breathe <robin.breathe@nexthink.com>
Signed-off-by: Brady Siegel <brsiegel@amazon.com>
@cert-manager-prow
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

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

@anbaig anbaig added the lgtm label Jun 27, 2024
@cert-manager-prow cert-manager-prow bot merged commit 9c5d2e0 into cert-manager:main Jun 27, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants