KatharaFramework / NetworkPlugin

Docker Network Plugin used by Kathará to create pure L2 networks.
https://www.kathara.org/
Apache License 2.0
17 stars 7 forks source link

On the road to multiarch support (hello ARM64) #2

Closed nopid closed 3 years ago

nopid commented 3 years ago

tl;dr a proper go.mod would help reproducible built and dependencies tracking.

In order to support several architectures, the NetworkPlugin itself has to be ported to the other architectures. Fortunately, golang is perfect for the task.

Unfortunately, the current version of the Makefile does not compile, leading to a dependency error :

go get: github.com/Sirupsen/logrus@none updating to
    github.com/Sirupsen/logrus@v1.8.1: parsing go.mod:
    module declares its path as: github.com/sirupsen/logrus
            but was required as: github.com/Sirupsen/logrus

The Sirupsen/logrus module has been renamed to sirupsen/logrus and github.com/docker/libnetwork v0.5.6 is still using the older version.

The NetworkPlugin would have better reproducible compilation with a go.mod specifying dependecies precisely.

I was able to recompile the plugin for ARM64 (see nopid/katharanp inside the docker hub) by adding an adhoc go.mod and changing the go get line of the Makefile into a go mod tidy. This worked under Ubuntu 20 with golang 1.16.2. For some reason, the same depencies fail with golang 1.16.5 under macOS 11.4.

Being no expert with docker, the other thing I cannot solve: is it possible to build a single name multiarch plugin in the docker hub that resolves into different architecture images like for classical images?

lorenzo93 commented 3 years ago

Hi @nopid ,

I've just merged your PR into a dev branch. I'll make some changes to how the compilation is made, moving also the go compilation into docker so a user will not need to have go installed in the system to build the network plugin. After that, I'll merge the dev branch into master and push the two versions of the network plugin.

Thanks a lot for your PRs