From e1164a597e05a11d2cab385c3a55319b38b44939 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 20 Jun 2025 13:00:09 +0000 Subject: [PATCH] feat: Add support for arm64 architecture This commit introduces support for the arm64 architecture by: 1. **Updating the Dockerfile:** * The `exporter/Dockerfile` now uses the `TARGETARCH` build argument to dynamically determine the correct path for `libiperf.so.0`. This allows the same Dockerfile to be used for building both `amd64` and `arm64` images. 2. **Modifying GitHub Workflows:** * The CI workflow (`.github/workflows/ci.yaml`) and the Release workflow (`.github/workflows/release.yml`) have been updated to build and push multi-architecture Docker images (`linux/amd64` and `linux/arm64`). * This involves adding the `docker/setup-qemu-action` for cross-compilation and specifying the target platforms in the `docker/build-push-action`. 3. **Helm Chart:** * No changes were required for the Helm chart as the image tag will now point to a multi-arch manifest, and the default iperf3 server image (`networkstatic/iperf3:latest`) is assumed to be multi-arch. Node selectors in the chart are not architecture-specific. These changes enable the deployment of the iperf3-monitor on Kubernetes clusters with arm64 nodes. --- .github/workflows/ci.yaml | 4 ++++ .github/workflows/release.yml | 4 ++++ exporter/Dockerfile | 5 ++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 40755e4..5282efb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -31,6 +31,9 @@ jobs: - name: Check out code uses: actions/checkout@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@v4 @@ -44,6 +47,7 @@ jobs: push: false # Do not push on PRs tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + platforms: linux/amd64,linux/arm64 test: name: Run Tests diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c4b49e2..9f80aac 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,6 +36,9 @@ jobs: - name: Check out code uses: actions/checkout@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Log in to GitHub Container Registry uses: docker/login-action@v2 with: @@ -56,6 +59,7 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + platforms: linux/amd64,linux/arm64 package-and-publish-chart: name: Package and Publish Helm Chart diff --git a/exporter/Dockerfile b/exporter/Dockerfile index 76a2138..ee67c32 100644 --- a/exporter/Dockerfile +++ b/exporter/Dockerfile @@ -17,9 +17,12 @@ FROM python:3.9-slim WORKDIR /app +# Declare TARGETARCH arg to be used in COPY instruction +ARG TARGETARCH + # Copy iperf3 binary and library from the builder stage COPY --from=builder /usr/bin/iperf3 /usr/bin/iperf3 -COPY --from=builder /usr/lib/x86_64-linux-gnu/libiperf.so.0 /usr/lib/x86_64-linux-gnu/libiperf.so.0 +COPY --from=builder /usr/lib/${TARGETARCH}-linux-gnu/libiperf.so.0 /usr/lib/${TARGETARCH}-linux-gnu/libiperf.so.0 # Copy installed Python packages from the builder stage COPY --from=builder /usr/local/lib/python3.9/site-packages /usr/local/lib/python3.9/site-packages