This document describes how to build the following Calico components from their source code.
- typha
- felix
- CNI plugins
- confd (Calico specific fork)
- Calico BGP daemon
- bird and bird6 (Calico specific fork)
- libnetwork plugin
- calicoctl
- calico/node
See each component repository for more details on the build process for that component.
These build instructions assume you have a Linux build environment with:
- Docker 1.12+
- git
- make
We recommend checking out all of the code to a common base directory. The instructions below assume the environment variable $BASEDIR has been set. For example:
export BASEDIR=~/go/src/github.com/projectcalico
This directory should exist:
mkdir -p $BASEDIR
These instructions describe how to build a particular release or Calico. This comprises of multiple sub components each individually versioned. To determine which particular tag (version) of code to checkout for each repo, consult the Releases page of the appropriate version of the Calico documentation
Define the following environment variables that describe the versions of each of the components that you are building (the instruction below use these):
VERSION_TYPHA
VERSION_FELIX
VERSION_CNI
VERSION_CONFD
VERSION_BIRD
VERSION_BGP_DAEMON
VERSION_LIBNETWORK
VERSION_CALICOCTL
VERSION_CALICO
For example, the v2.3.0 release of Calico would define the following:
export VERSION_TYPHA=v0.2.0
export VERSION_FELIX=2.3.0
export VERSION_CNI=v1.9.1
export VERSION_CONFD=v0.12.1-calico0.1.0
export VERSION_BIRD=v0.3.1
export VERSION_BGP_DAEMON=v0.2.1
export VERSION_LIBNETWORK=v1.1.0
export VERSION_CALICOCTL=v1.3.0
export VERSION_CALICO=v2.3.0
The following sections should be followed in order as there are cross dependencies between the various components that have been built.
To build typha, clone the typha repo and checkout the correct tag.
cd $BASEDIR
git clone --depth 1 --single-branch --branch $VERSION_TYPHA [email protected]:projectcalico/typha.git
cd typha
Build the calico/typha
docker image (which also builds the associated binaries) and
retag the image with the correct version.
make clean
make calico/typha
docker tag calico/typha calico/typha:$VERSION_TYPHA
This builds the following:
- The
calico/typha
Docker image - The
bin/calico-typha
binary (included in the Docker image)
To build felix, clone the felix repo and checkout the correct tag.
cd $BASEDIR
git clone --depth 1 --single-branch --branch $VERSION_FELIX [email protected]:projectcalico/felix.git
cd felix
Build the calico/felix
docker image (which also builds the associated binaries) and
retag the image with the correct version.
make clean
make calico/felix
docker tag calico/felix calico/felix:$VERSION_FELIX
This builds the following:
- The
calico/felix
Docker image - The
bin/calico-felix
binary (included in the Docker image)
To build Calico CNI plugins, clone the felix repo and checkout the correct tag.
cd $BASEDIR
git clone --depth 1 --single-branch --branch $VERSION_CNI [email protected]:projectcalico/cni-plugin.git
cd cni-plugin
Build the calico/cni
docker image (which also builds the associated binaries) and
retag the image with the correct version.
make clean
make docker-image
docker tag calico/cni calico/cni:$VERSION_CNI
This builds the following:
- The
calico/cni
Docker image - The
dist/calico
binary (included in the Docker image) - The
dist/calico-ipam
binary (included in the Docker image)
The following binaries (included in the Docker image) are pulled directly from the containernetworking/cni releases:
- The
dist/flannel
binary (included in the Docker image) - The
dist/host-local
binary (included in the Docker image) - The
dist/loopback
binary (included in the Docker image)
The following binary (included in the Docker image) is pulled from the Calico CNI plugin releases page and is a build of the containernetworking/cni portmap plugin. The build process for this plugin has yet to be formalized:
- The
dist/portmap
binary (included in the Docker image)
To build confd, clone the confd repo and checkout the correct tag.
cd $BASEDIR
git clone --depth 1 --single-branch --branch $VERSION_CONFD [email protected]:projectcalico/confd.git
cd confd
Build the confd
static binary.
make bin/confd
This builds the following:
- The
bin/confd
binary
To build the Calico BGP daemon, clone the calico-bgp-daemon repo and checkout the correct tag.
cd $BASEDIR
git clone --depth 1 --single-branch --branch $VERSION_BGP_DAEMON [email protected]:projectcalico/calico-bgp-daemon.git
cd calico-bgp-daemon
Build the calico-bgp-daemon
static binary.
make build-containerized
This builds the following:
- The
dist/calico-bgp-daemon
binary - The
dist/gobgp
binary
To build the bird and bird6 binaries, clone the bird repo and checkout the correct tag.
cd $BASEDIR
git clone --depth 1 --single-branch --branch $VERSION_BIRD [email protected]:projectcalico/bird.git
git clone [email protected]:projectcalico/bird.git
cd bird
Build the bird
, bird6
and birdcl
static binaries.
./build.sh
This builds the following:
- The
dist/bird
binary - The
dist/bird6
binary - The
dist/birdcl
binary
To build the libnetwork-plugin binaries, clone the libnetwork-plugin repo and checkout the correct tag.
cd $BASEDIR
git clone --depth 1 --single-branch --branch $VERSION_LIBNETWORK_PLUGIN [email protected]:projectcalico/libnetwork-plugin.git
cd libnetwork-plugin
Build the calico/libnetwork-plugin
container.
make clean
make calico/libnetwork-plugin
This builds the following:
- The
calico/libnetwork-plugin
Docker image - The
dist/libnetwork-plugin
binary
To build the calicoctl binary, clone the calicoctl repo and checkout the correct tag
cd $BASEDIR
git clone --depth 1 --single-branch --branch $VERSION_CALICOCTL [email protected]:projectcalico/calicoctl.git
cd calicoctl
Build the calicoctl
binaries (available for different Linux, Mac and Windows) and the
calico/ctl
container:
make clean
make dist/calicoctl dist/calicoctl-darwin-amd64 dist/calicoctl-windows-amd64.exe calico/ctl
This builds the following:
- The
dist/calicoctl
binary - The
dist/calicoctl-darwin-amd64
binary - The
dist/calicoctl-windows-amd64.exe
binary - The
calico/ctl
container image
To build the calico/node container, clone the calico repo and checkout the correct tag
cd $BASEDIR
git clone --depth 1 --single-branch --branch $VERSION_CALICO [email protected]:projectcalico/calico.git
cd calico
To build the calico/node image using the images built in the previous steps, start by copying the various binaries into the working directory:
mkdir -p calico_node/filesystem/bin
cp $BASEDIR/confd/bin/confd $BASEDIR/calico/calico_node/confd
cp $BASEDIR/bird/dist/* $BASEDIR/calico/calico_node/
cp $BASEDIR/felix/bin/calico-felix $BASEDIR/calico/calico_node/calico-felix
cp $BASEDIR/calico-bgp-daemon/dist/* $BASEDIR/calico/calico_node/
cp $BASEDIR/libnetwork-plugin/dist/libnetwork-plugin $BASEDIR/calico/calico_node/calico-bgp-daemon
Build the calico/node
container:
make calico/node
docker tag calico/node calico/node:$VERSION_CALICO
This builds the following:
- The
calico/node
container image