Note that the documentation in this repo is targeted at Calico contributors.
This repository contains the source code for Project Calico's per-host daemon, Felix.
How can I get support for contributing to Project Calico?
Who is behind Project Calico?
Tigera, Inc. is the company behind Project Calico and is responsible for the ongoing management of the project. However, it is open to any members of the community – individuals or organizations – to get involved and contribute code.
Thanks for thinking about contributing to Project Calico! The success of an open source project is entirely down to the efforts of its contributors, so we do genuinely want to thank you for even thinking of contributing.
Before you do so, you should check out our contributing guidelines in the
CONTRIBUTING.md file, to make sure it's as easy as possible for us to accept
How do I build Felix?
Felix mostly uses Docker for builds. We develop on Ubuntu 16.04 but other
Linux distributions should work (there are known
Makefile issues that prevent building on OS X).
To build Felix, you will need:
- A suitable linux box.
- To check out the code into your GOPATH.
- Docker >=1.12
- GNU make.
- Plenty of disk space (since the builds use some heavyweight full-OS containers in order to build debs and RPMs).
Then, as a one-off, run
which will install a couple more go tools that we haven't yet containerised.
Then, to build the calico-felix binary:
calico/felix docker image:
When you run
make build or
make image, it creates the felix binary or docker image for linux on your architecture. The outputs are as follows:
When you are running on
amd64, you can build the binaries and images for other platforms by setting the
ARCH variable. For example:
$ make build ARCH=arm64 # OR $ make image ARCH=ppc64le
If you wish to make all of the binaries or images, use the standard calico project targets
$ make build-all # OR $ make image-all
Note that the
image-all targets have the
build targets as a depedency.
How can I run Felix's unit tests?
To run all the UTs:
To start a
ginkgo watch, which will re-run the relevant UTs as you update files:
To get coverage stats:
How can a subset of the go unit tests?
If you want to be able to run unit tests for specific packages for more iterative development, you'll need to install
- GNU make
- go >=1.7
make update-tools to install ginkgo, which is the test tool used to
run Felix's unit tests.
There are several ways to run ginkgo. One option is to change directory to the
package you want to test, then run
ginkgo. Another is to use ginkgo's
watch feature to monitor files for changes:
cd go ginkgo watch -r
Ginkgo will re-run tests as files are modified and saved.
How do I build packages/run Felix?
After building the docker image (see above), you can run Felix and log to screen with, for example:
docker run --privileged \ --net=host \ -v /run:/run \ -e FELIX_LOGSEVERITYSCREEN=INFO \ calico/felix
--privilegedis required because Felix needs to execute iptables and other privileged commands.
--net=hostis required so that Felix can manipulate the routes and iptables tables in the host namespace (outside its container).
-v /run:/runis required so that Felix shares the global iptables file lock with other processes; this allows Felix and other daemons that manipulate iptables to avoid clobbering each other's updates.
-e FELIX_LOGSEVERITYSCREEN=INFOtells Felix to log at info level to stderr.
Debs and RPMs
Makefile has targets for building debs and RPMs for different platforms.
By using docker, the build does not need to be run on the target platform.
make deb make rpm
The packages (and source packages) are output to the dist directory.