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

new(docker,scripts): port all docker images to be multiarch ready #1990

Merged
merged 3 commits into from
Jun 7, 2022

Conversation

FedeDP
Copy link
Contributor

@FedeDP FedeDP commented May 4, 2022

What type of PR is this?

Uncomment one (or more) /kind <> lines:

/kind bug

/kind cleanup

/kind design

/kind documentation

/kind failing-test

/kind feature

If contributing rules or changes to rules, please make sure to also uncomment one of the following line:

/kind rule-update

/kind rule-create

Any specific area of the project related to this PR?

Uncomment one (or more) /area <> lines:

/area build

/area engine

/area rules

/area tests

/area proposals

What this PR does / why we need it:

New dockerfiles are multiplatform ready: they can be pushed with docker buildx for various architectures.
Moreover, updated falco-driver-loader to support multiple architectures.

Which issue(s) this PR fixes:

Fixes #1813
Fixes #1589

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

They can be pushed with `docker buildx` for various architectures.

Moreover, updated falco-driver-loader to support multiple architectures.

Signed-off-by: Federico Di Pierro <[email protected]>
ENV FALCO_VERSION=
ENV BUILD_TYPE=release

ADD https://github.com/fullstorydev/grpcurl/releases/download/v1.6.0/grpcurl_1.6.0_linux_x86_64.tar.gz /
RUN if [ "$TARGETARCH" = "amd64" ] ; then curl -L -o grpcurl.tar.gz \
https://github.com/fullstorydev/grpcurl/releases/download/v1.8.6/grpcurl_1.8.6_linux_x86_64.tar.gz; \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

grpcurl was bumped to 1.8.6 because 1.6.0 was not released for arm64.
Therefore, bumped it to the latest version.


RUN apt update -y
RUN apt install dkms -y

ADD falco-${FALCO_VERSION}-x86_64.deb /
RUN dpkg -i /falco-${FALCO_VERSION}-x86_64.deb
ADD falco-${FALCO_VERSION}-*.deb /
Copy link
Contributor Author

@FedeDP FedeDP May 4, 2022

Choose a reason for hiding this comment

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

Since ADD does not support any conditional (based on TARGETARCH), we just add any package (same is being done for rpm and binary packages), and then only install the right one for our architecture in the RUN command.
It should not really matter because docker/tester/root/usr/bin/entrypoint will only copy correct architecture one into runner-rootfs.

@FedeDP FedeDP changed the title wip: new(docker,scripts): port all docker images to be multiarch ready new(docker,scripts): port all docker images to be multiarch ready May 6, 2022
…uild multiplatform images.

Signed-off-by: Federico Di Pierro <[email protected]>
@FedeDP FedeDP force-pushed the new/arm64_docker_images branch from f05490e to e79706b Compare May 6, 2022 08:22
@@ -389,74 +389,80 @@ jobs:
# Publish docker packages
"publish/docker-dev":
docker:
- image: docker:stable
- image: cimg/base:stable
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Switched to cimg/base:stable as it already provides docker buildx command for us, when a 20.10.x version of docker is requested.

URL=$(echo "${DRIVERS_REPO}/${DRIVER_VERSION}/${FALCO_KERNEL_MODULE_FILENAME}" | sed s/+/%2B/g)
if [ "${ARCH}" == "x86_64" ]; then
# x86_64 still uses root
URL=$(echo "${DRIVERS_REPO}/${DRIVER_VERSION}/${FALCO_KERNEL_MODULE_FILENAME}" | sed s/+/%2B/g)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We will leave x86_64 drivers in their root folder, where they are now, to retain backward compatibility.
New archs will instead go below $arch subfolder.

This was referenced May 9, 2022
@FedeDP
Copy link
Contributor Author

FedeDP commented May 13, 2022

I just ported publish-rpm and publish-deb scripts to be multiarch.
They must be now called once with list of deb files (one for each supported arch).

Publish-rpm was locally tested, while publish-deb was tested on same docker image used by circleCI: docker.io/debian:stable, to double check the added script dependency (dpkg).

Of course, in both test, i disabled aws s3/cloudfron download and sync.

Publish-deb was the harder one; basically, i fixed the publsih-deb script and then tested adding the new local repo to apt sources, and double checked that apt could actually update and install from the repo.
The repo tree must be equal to https://download.falco.org/?prefix=packages/deb/.

root@60afe6470047:/tmp/falco-deb# ls
dists  stable

ls dists/stable/
Release  Release.gpg  main

root@60afe6470047:/tmp/falco-deb# cat dists/stable/Release
Architectures: amd64,arm64
Codename: stable
Components: main
Date: Fri, 13 May 2022 09:21:52 +0000
Label: Falco
Origin: Falco
Suite: stable
MD5Sum:
5825c4e96c8acfb055ba545635c63b36              140 Release
affb84c8f074475175ae46ba9b158af7             1205 main/binary-amd64/Packages
bebf147595828eb82fadc8f7bdea68d7              824 main/binary-amd64/Packages.bz2
077fde40e75311196557166ce81d4fa3              783 main/binary-amd64/Packages.gz
0fd7b90883437a343949b9c71063e6de             1206 main/binary-arm64/Packages
d4d22eb0f42c88615118eb49e1777fd4              820 main/binary-arm64/Packages.bz2
0e8adb1fb50a24c5ee5b2abefcc43328              784 main/binary-arm64/Packages.gz
[more...]

root@60afe6470047:/tmp/falco-deb# cat dists/stable/main/binary-arm64/Packages
Package: geoip-bin
Architecture: arm64
Version: 1.6.12-8
[more...]

root@60afe6470047:/tmp/falco-deb# cat dists/stable/main/binary-amd64/Packages
Package: geoip-bin
Architecture: amd64
Version: 1.6.12-8
[more...]

root@60afe6470047:/tmp/falco-deb# ls stable/
geoip-bin_1.6.12-8_amd64.deb  geoip-bin_1.6.12-8_amd64.deb.asc  geoip-bin_1.6.12-8_arm64.deb  geoip-bin_1.6.12-8_arm64.deb.asc

root@60afe6470047:/tmp/falco-deb# apt-cache showpkg geoip-bin
Package: geoip-bin
Versions:
1.6.12-8 (/var/lib/apt/lists/_tmp_falco-deb_dists_stable_main_binary-amd64_Packages.lz4)

Copy link
Member

@leogr leogr left a comment

Choose a reason for hiding this comment

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

This is spectacular, I just need to find some time to test it deeply.

Thank you! 🤗

@leogr
Copy link
Member

leogr commented May 23, 2022

I think we don't have enough time to test this. Moving to the next milestone.
/milestone 0.33.0

@poiana poiana added this to the 0.33.0 milestone May 23, 2022
@jasondellaluce
Copy link
Contributor

@FedeDP, should we link this to #1813 with Fixes# if that's gonna be closed once this will get merged?

@FedeDP
Copy link
Contributor Author

FedeDP commented Jun 6, 2022

You are right jason! Thanks!

@jasondellaluce
Copy link
Contributor

This one too I think! #1589

Copy link
Contributor

@jasondellaluce jasondellaluce left a comment

Choose a reason for hiding this comment

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

/approve

This is a big change, but since we just released Falco 0.32 I think this is the right time to test it! Great work Fede!

@poiana
Copy link
Contributor

poiana commented Jun 7, 2022

LGTM label has been added.

Git tree hash: 518aa4f397f3917a81a9be1675bf1f27c06e936d

@poiana
Copy link
Contributor

poiana commented Jun 7, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: FedeDP, jasondellaluce

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

@poiana poiana added the approved label Jun 7, 2022
@poiana poiana merged commit 3f29660 into falcosecurity:master Jun 7, 2022
@FedeDP FedeDP deleted the new/arm64_docker_images branch June 7, 2022 09:06
@jasondellaluce jasondellaluce modified the milestones: 0.33.0, 0.32.1 Jun 17, 2022
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.

Multi-arch docker image request Support arm64 architecture in dockerhub
4 participants