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: add initial support for multi architecture builds #65

Merged
merged 8 commits into from
Jul 26, 2024

Conversation

fbuchmeier-abi
Copy link
Contributor

Features

  • build pod-pacemaker for amd64 and arm64/v8 using docker buildx
  • automatically import the correct image into kind depending on the architecture of the machine executing the build

Known Issues

…u.incrementBy

Merge in OSSC/woehrl01-pod-pacemaker from fix/issue-35 to main

* commit 'f093131602e7b2cf36a425f3dfef88b4ab172352':
  docs: fix value range for cpu.maxLoad and cpu.incrementBy
@fbuchmeier-abi
Copy link
Contributor Author

Build Log

~/git/github.com/fbuchmeier-abi/woehrl01-pod-pacemaker (feat/issue-64-arm64-v8*) » make docker-build                                              (kind-kind/default)
docker buildx create --use
docker buildx build --load --platform linux/amd64 --tag ghcr.io/woehrl01/pod-pacemaker:v0.0.1-amd64 . 
docker buildx build --load --platform linux/arm64/v8 --tag ghcr.io/woehrl01/pod-pacemaker:v0.0.1-arm64 .
eager_wu
[+] Building 47.0s (18/18) FINISHED                                                                                                                                   
 ...
 => => exporting layers                                                                                                                                          2.6s
 => => exporting manifest sha256:ecf1eed43b6fe09370420002ca37fb109306ad97892dd8b533bffcad64ad47e4                                                                0.0s
 => => exporting config sha256:fda774d51b6aa99d9c3838daaca9fee1d041b68677b8e9b2eee5572f52ceab00                                                                  0.0s
 => => sending tarball                                                                                                                                           0.9s
 => importing to docker                                                                                                                                          0.8s
[+] Building 98.3s (10/14)                                                                                                                                            
 ...
 => => exporting layers                                                     2.2s
 => => exporting manifest sha256:925fc6ab9a6f5a913c114efcb86660e6dae5abdfd  0.0s
 => => exporting config sha256:6344146ffee795deb3c382c5acca6b2b7b578c7083c  0.0s
 => => sending tarball                                                      0.7s
 => WARN: Requested platform "linux/amd64" does not match result platform   2.9s
 => importing to docker                                                     0.5s

 1 warning found (use --debug to expand):
 - Requested platform "linux/amd64" does not match result platform "linux/arm64"
---------------------------------------------------------------------------------
~/git/github.com/fbuchmeier-abi/woehrl01-pod-pacemaker (feat/issue-64-arm64-v8*) » make kind-load                                             (kind-kind/default)
Image: "" with ID "sha256:fda774d51b6aa99d9c3838daaca9fee1d041b68677b8e9b2eee5572f52ceab00" not yet present on node "kind-control-plane", loading...
---------------------------------------------------------------------------------
~/git/github.com/fbuchmeier-abi/woehrl01-pod-pacemaker (feat/issue-64-arm64-v8*) » make kind-deploy                                           (kind-kind/default)
Release "pod-pacemaker" has been upgraded. Happy Helming!
NAME: pod-pacemaker
LAST DEPLOYED: Fri Jul 26 10:29:21 2024
NAMESPACE: default
STATUS: deployed
REVISION: 7
TEST SUITE: None
------------------------------------------------------------------------------------------
~/git/github.com/fbuchmeier-abi/woehrl01-pod-pacemaker (feat/issue-64-arm64-v8*) » k get pods -o json | jq '.items[].spec.containers[] | .image'             
"ghcr.io/woehrl01/pod-pacemaker:v0.0.1-amd64"

@woehrl01
Copy link
Owner

Requested platform "linux/amd64" does not match result platform "linux/arm64" seems like an error right? it's showing that during the arm64 build.

@fbuchmeier-abi
Copy link
Contributor Author

fbuchmeier-abi commented Jul 26, 2024

You are right, let me check that. My guess is that the warning is triggered because I am building an arm64 image and then importing (loading) it into an amd64 docker daemon. The binaries themselves look good to me, but I have yet to test them out on arm64 instances:

readelf -a cni-plugin | head -n 20   
ELF Header:
  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF64
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           AArch64
  Version:                           0x1
  Entry point address:               0x819a0
  Start of program headers:          64 (bytes into file)
  Start of section headers:          400 (bytes into file)
  Flags:                             0x0
  Size of this header:               64 (bytes)
  Size of program headers:           56 (bytes)
  Number of program headers:         6
  Size of section headers:           64 (bytes)
  Number of section headers:         23
  Section header string table index: 20

I'll see if I can switch to my new images (multi-arch) in my test environment. Will get back to you in an hour or so.

@fbuchmeier-abi
Copy link
Contributor Author

fbuchmeier-abi commented Jul 26, 2024

I've successfully rolled out the ARM64 build on AWS Graviton (t4g) instances. For the build to succeed reproducibly I had to make some changes to the Dockerfile as well. I'll update my PR accordingly in a few minutes.

pod logs

 Defaulted container "node-daemon" out of: node-daemon, init-cni (init)
time="2024-07-26T13:33:14Z" level=info msg="Config default-pacemaker-config matches node labels"
time="2024-07-26T13:33:14Z" level=info msg="Throttler is active: PriorityThrottler, condition: maxConcurrent = 2, perCpu = 0.5"
time="2024-07-26T13:33:14Z" level=info msg="Throttler is active: PriorityThrottler, condition: current CPU Load < 80"
time="2024-07-26T13:33:14Z" level=info msg="No taint 'pod-pacemaker' found on node, no update required."
time="2024-07-26T13:33:14Z" level=info msg="Node daemon started on node ip-xxx-xxx-xxx-182.eu-central-1.compute.internal"
time="2024-07-26T13:33:14Z" level=info msg="server listening at /var/run/pod-pacemaker/pod-pacemaker.sock"

node labels

apiVersion: v1
kind: Node
metadata:
  creationTimestamp: "2024-07-26T13:29:59Z"
    kubernetes.io/arch: arm64
    kubernetes.io/hostname: ip-xxx-xxx-xxx-182.eu-central-1.compute.internal
    kubernetes.io/os: linux
    node.kubernetes.io/instance-type: t4g.xlarge

UPDATE: I've updated the dockerfile & makefile accordingly and builds now work fast and stable for me (on amd64).

@woehrl01
Copy link
Owner

Looks great! Thank you!

@woehrl01 woehrl01 changed the title Feat/issue 64 arm64 v8 - add initial support for multi architecture builds feat: add initial support for multi architecture builds Jul 26, 2024
@woehrl01 woehrl01 merged commit 0efb13f into woehrl01:main Jul 26, 2024
1 check passed
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.

2 participants