kiam icon indicating copy to clipboard operation
kiam copied to clipboard

Introduce multiarch docker image build

Open commixon opened this issue 3 years ago • 6 comments

This PR tries to address this: https://github.com/uswitch/kiam/issues/454

Our use case: We have migrated parts of our kubernetes clusters in AWS to graviton (arm) by introducing graviton based nodegroups. It would be really nice to be able to utilize OCI's multiarch abilities, having the same charts and letting the container daemon choose the appropriate OS architecture build.

IMPORTANT: This PR is mostly a poc to kickstart the conversation to possibly support mutliarch builds, although it does work as it is.

  • Dedicated multiarch Dockerfile The reason for a discrete Dockerfile is in order to not mess any existing pipeline. The only diff between the two files is:
17c17
< RUN make bin/kiam-linux-amd64
---
> RUN CGO_ENABLED=0 go build -o bin/kiam cmd/kiam/*.go
21c21
< COPY --from=build /workspace/bin/kiam-linux-amd64 /kiam
---
> COPY --from=build /workspace/bin/kiam /kiam
  • Utilize github-actions with docker buildx functionality I am not really comfortable with drone ci, so that's why github actions are utilized here. Moreover, the docker/setup-qemu-action@v1, docker/setup-buildx-action@v1 and docker/setup-buildx-action@v1 seem to do all the complex multiarch work really well.

In case github actions are introduced to the upstream repo, there are 4 github repository secrets that are needed: DOCKER_USERNAME: username used in drone.yml DOCKER_PASSWORD: password used in drone.yml DOCKER_REGISTRY: quay.io DOCKER_ORGANIZATION: uswitch

Just for reference, here is a github action run from my fork: https://github.com/commixon/kiam/actions/runs/657481318 , and here is a successful multiarch build Screenshot 2021-03-16 at 13 30 23

commixon avatar Mar 16 '21 12:03 commixon

Very cool. I'm definitely open to us switching to GitHub actions for running the builds.

I'm not sure I have much time to take a look that soon but it's a really cool contribution!

pingles avatar Mar 19 '21 15:03 pingles

Btw if you need me to tweak anything or shape this somehow, just let me know. I was thinking that maybe this could be run in parallel with the drone ci for an easier transition, if time is an issue for you.

commixon avatar Mar 20 '21 20:03 commixon

That would be very useful for us as well if it goes though :pray:

astrikos avatar Mar 25 '21 08:03 astrikos

Hi. Is this accepted?

We would also like to run Arm64 images in our clusters.

kevdowney avatar Aug 04 '21 18:08 kevdowney

Any updates on this? We have started migrating to Arm64 as well so this would be awesome to have.

BTW, thanks @commixon! Used your images from above to test transitioning and they worked quite nicely! 👏🏽

rfasouliotis avatar Oct 08 '21 22:10 rfasouliotis

I got stuck trying to find good multi-arch images for v4.2 which includes some important library upgrades... https://hub.docker.com/r/jontg/kiam is multi-arch and has the latest changes from 4.2, build from https://github.com/airkit/kiam (I'm not opening a new PR since this one already has a more comprehensive change). Enjoy in good health!

jontg avatar May 18 '22 18:05 jontg