Skip to content

calico 2.6.9 draft recipe

Guirish Salgaonkar edited this page May 30, 2018 · 11 revisions

Building Calico

The instructions specify the steps to build Calico version v2.6.9 on Linux on IBM Z for following distributions:

  • RHEL (7.3, 7.4, 7.5)
  • Ubuntu (16.04, 18.04)
  • SLES (12 SP2, 12 SP3)

General Notes:

  • When following the steps below please use a standard permission user unless otherwise specified.

  • A directory /<source_root>/ will be referred to in these instructions, this is a temporary writable directory anywhere you'd like to place it.

Prerequisites

  • Go -- Instructions for building Go can be found here.
  • Docker -- Instructions for install Docker can be found here
  • etcd -- Instructions for building etcd can be found here

Building Calico

1. Install the system dependencies

  • RHEL (7.3, 7.4)
   sudo yum install curl git wget tar gcc glibc-static.s390x make
  • SLES (12 SP2, 12 SP3)
   sudo zypper install curl git wget tar gcc glibc-static.s390x make
  • Ubuntu (16.04, 17.10, 18.04)
   sudo apt-get update
   sudo apt-get install git curl tar gcc wget make

2. Build calicoctl and calico/node image

2.1 Build go-build

This builds a docker image calico/go-build that is used to build other components

   cd /<source_root>/
   export GOPATH=`pwd`
   git clone https://github.com/projectcalico/go-build $GOPATH/src/github.com/projectcalico/go-build
   cd $GOPATH/src/github.com/projectcalico/go-build
   git checkout v0.9

Add Dockerfile.s390x for s390x

FROM s390x/golang:1.9.2-alpine3.6
MAINTAINER LoZ Open Source Ecosystem (https://www.ibm.com/developerworks/community/groups/community/lozopensource)

# Install su-exec for use in the entrypoint.sh (so processes run as the right user)
# Install bash for the entry script (and because it's generally useful)
# Install curl to download glide
# Install git for fetching Go dependencies
# Install ssh for fetching Go dependencies
# Install mercurial for fetching go dependencies
# Install wget for fetching glibc
# Install make for building things
# Install util-linux for column command (used for output formatting).
RUN apk add --no-cache su-exec curl bash git openssh mercurial make wget util-linux tini
RUN apk upgrade --no-cache

# Disable ssh host key checking
RUN echo 'Host *' >> /etc/ssh/ssh_config
RUN echo '    StrictHostKeyChecking no' >> /etc/ssh/ssh_config

# Install glibc
RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://raw.githubusercontent.com/sgerrand/alpine-pkg-glibc/master/sgerrand.rsa.pub
RUN wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.23-r3/glibc-2.23-r3.apk
RUN apk add glibc-2.23-r3.apk

# Disable cgo so that binaries we build will be fully static.
ENV CGO_ENABLED=0

# Recompile the standard library with cgo disabled.  This prevents the standard library from being
# marked stale, causing full rebuilds every time.
RUN go install -v std

# Install glide
RUN go get github.com/Masterminds/glide
ENV GLIDE_HOME /home/user/.glide

# Install ginkgo CLI tool for running tests
RUN go get github.com/onsi/ginkgo/ginkgo

# Install linting tools.  We pin gometalinter to a working master revision to pick up
# a go v1.9 compatibility patch that hasn't been released.
RUN go get -u -d github.com/alecthomas/gometalinter && \
    cd /go/src/github.com/alecthomas/gometalinter && \
    git checkout cc4415ed09f7073d595ee504cad4d98b71a3038e && \
    go install github.com/alecthomas/gometalinter
RUN ln -s `which gometalinter` /usr/local/bin/gometalinter
RUN gometalinter --install

# Install license checking tool.
RUN go get github.com/pmezard/licenses

# Install tool to merge coverage reports.
RUN go get github.com/wadey/gocovmerge

RUN go get github.com/mikefarah/yaml

# Install patched version of goveralls (upstream is bugged if not used from Travis).
RUN go get -u -d github.com/fasaxc/goveralls && \
  cd /go/src/github.com/fasaxc/goveralls && \
  git checkout tags/v0.0.1-smc && \
  go install github.com/fasaxc/goveralls

# Ensure that everything under the GOPATH is writable by everyone
RUN chmod -R 777 $GOPATH

COPY entrypoint.sh /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/entrypoint.sh"]

Make below changes to Makefile

@@ -4,3 +4,6 @@ calico/go-build:

 calico/go-build-ppc64le:
        docker build --pull -t calico/go-build-ppc64le -f Dockerfile.ppc64le .
+
+calico/go-build-s390x:
+               docker build --pull -t calico/go-build-s390x -f Dockerfile.s390x .

Build calico/go-build image

   make calico/go-build-s390x
   docker tag calico/go-build-s390x:latest calico/go-build:latest
2.2 Build calicoctl binary and calico/ctl image
   git clone https://github.com/projectcalico/calicoctl $GOPATH/src/github.com/projectcalico/calicoctl
   cd $GOPATH/src/github.com/projectcalico/calicoctl
   git checkout v1.6.4

Modify Makefile for s390x

@@ -80,9 +80,16 @@ dist/calicoctl: $(CALICOCTL_FILES) vendor
        $(MAKE) dist/calicoctl-linux-amd64
        mv dist/calicoctl-linux-amd64 dist/calicoctl

+dist/calicoctl-s390x: $(CALICOCTL_FILES) vendor
+       $(MAKE) dist/calicoctl-linux-s390x
+       mv dist/calicoctl-linux-s390x dist/calicoctl
+
 dist/calicoctl-linux-amd64: $(CALICOCTL_FILES) vendor
        $(MAKE) OS=linux ARCH=amd64 binary-containerized

+dist/calicoctl-linux-s390x: $(CALICOCTL_FILES) vendor
+       $(MAKE) OS=linux ARCH=s390x binary-containerized
+
 dist/calicoctl-darwin-amd64: $(CALICOCTL_FILES) vendor
        $(MAKE) OS=darwin ARCH=amd64 binary-containerized

Build the calicoctl binary

   docker tag calico/go-build calico/go-build:v0.8
   make  dist/calicoctl-s390x

Modify the calicoctl/Dockerfile.calicoctl as follow

@@ -1,4 +1,4 @@
-FROM alpine:3.4
+FROM s390x/alpine:3.6
 MAINTAINER Tom Denham <tom@projectcalico.org>

 ADD dist/calicoctl ./calicoctl
@@ -6,16 +6,5 @@
 ENV CALICO_CTL_CONTAINER=TRUE
 ENV PATH=$PATH:/

-# glibc and libltdl are needed by docker command line tool
-ENV GLIBC_VERSION 2.23-r3
-RUN apk add --no-cache libltdl
-RUN apk add --no-cache --update wget openssl ca-certificates && \
-  wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://raw.githubusercontent.com/sgerrand/alpine-pkg-glibc/master/sgerrand.rsa.pub && \
-  wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk && \
-  wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-bin-${GLIBC_VERSION}.apk && \
-  apk add glibc-${GLIBC_VERSION}.apk glibc-bin-${GLIBC_VERSION}.apk && \
-  rm -f glibc-${GLIBC_VERSION}.apk glibc-bin-${GLIBC_VERSION}.apk && \
-  apk del openssl ca-certificates wget
-
 WORKDIR /root
 ENTRYPOINT ["/calicoctl"]

Build the calico/ctl image

   make  calico/ctl
   docker tag calico/ctl calico/ctl:v1.6.4
2.3 Build bird
   git clone https://github.com/projectcalico/bird $GOPATH/src/github.com/projectcalico/bird
   cd $GOPATH/src/github.com/projectcalico/bird
   git checkout v0.3.2
  • Create Dockerfile-s390x with following content

    FROM s390x/alpine:3.6
    MAINTAINER Tom Denham <tom@projectcalico.org>
    
    RUN apk update
    RUN apk add alpine-sdk linux-headers autoconf flex bison ncurses-dev readline-dev
    
    WORKDIR /code
  • Modify build.sh as follows

    @@ -14,6 +14,10 @@ if [ $ARCH = ppc64le ]; then
         ARCHTAG=-ppc64le
    fi
    
    +if [ $ARCH = s390x ]; then
    +        ARCHTAG=-s390x
    +fi
    +
    DIST=dist/$ARCH
    
    docker build -t birdbuild$ARCHTAG -f Dockerfile$ARCHTAG .
  • Run build.sh to build 3 executable files (in dist/s390x/)

    ARCH=s390x ./build.sh
2.4 Build confd
   git clone https://github.com/projectcalico/confd $GOPATH/src/github.com/projectcalico/confd
   cd $GOPATH/src/github.com/projectcalico/confd
   git checkout v0.12.1-calico-0.4.4
  • Modify Dockerfile to change FROM alpine to FROM s390x/alpine:3.6

  • Build the confd binaries

    make container
2.5 Build libnetwork-plugin
   docker tag calico/go-build:latest calico/go-build:v0.9
   git clone https://github.com/projectcalico/libnetwork-plugin $GOPATH/src/github.com/projectcalico/libnetwork-plugin
   cd $GOPATH/src/github.com/projectcalico/libnetwork-plugin
   git checkout v1.1.2

Modify Dockerfile to change FROM alpine to FROM s390x/alpine:3.6 and build

   make calico/libnetwork-plugin
2.6 Build felix

To build felix it needs felixbackend.pb.go that is generated by a docker image calico/protoc. Let's first built this image.

   git clone https://github.com/tigera/docker-protobuf $GOPATH/src/github.com/projectcalico/docker-protobuf
   cd  $GOPATH/src/github.com/projectcalico/docker-protobuf

Modify Dockerfile

@@ -1,11 +1,11 @@
-FROM golang:1.9.2
+FROM s390x/golang:1.9.2

 MAINTAINER Shaun Crampton <shaun@tigera.io>

 ADD . /src
 WORKDIR /src

-ENV PROTOBUF_TAG v3.5.1
+ENV PROTOBUF_TAG v3.4.1

 RUN ./build.sh

Build docker image calico/protoc

   docker build -t calico/protoc .
   docker tag calico/protoc calico/protoc-s390x

Build felix

   git clone https://github.com/projectcalico/felix $GOPATH/src/github.com/projectcalico/felix
   cd $GOPATH/src/github.com/projectcalico/felix
   git checkout 2.6.7
  • Modify Makefile as follows

    @@ -59,6 +59,10 @@ ifeq ($(ARCH),ppc64le)
     GO_BUILD_VER:=latest
     endif
    
    +ifeq ($(ARCH),s390x)
    +GO_BUILD_VER:=latest
    +endif
    +
     GO_BUILD_CONTAINER?=calico/go-build$(ARCHTAG):$(GO_BUILD_VER)
    
     help:
  • Change directory to docker-image folder

    cd docker-image
  • Create Dockerfile-s390x with following content

    FROM s390x/alpine:3.6
    MAINTAINER LoZ Open Source Ecosystem (https://www.ibm.com/developerworks/community/groups/community/lozopensource)
    
    # Since our binary isn't designed to run as PID 1, run it via the tini init daemon.
    RUN apk --no-cache add --update tini
    ENTRYPOINT ["/sbin/tini", "--"]
    
    # Install Felix's dependencies.
    RUN apk --no-cache add ip6tables ipset iputils iproute2 conntrack-tools
    
    ADD felix.cfg /etc/calico/felix.cfg
    
    # Put out binary in /code rather than directly in /usr/bin.  This allows the downstream builds
    # to more easily extract the Felix build artefacts from the container.
    RUN mkdir /code
    ADD bin/calico-felix /code
    WORKDIR /code
    RUN ln -s /code/calico-felix /usr/bin
    
    # Run felix by default
    CMD ["calico-felix"]
  • Build the felix binaries

    cd $GOPATH/src/github.com/projectcalico/felix
    ARCH=s390x make calico/felix

2.7 Build Typha

  • Download the source code

    git clone https://github.com/projectcalico/typha $GOPATH/src/github.com/projectcalico/typha
    cd $GOPATH/src/github.com/projectcalico/typha
    git checkout v0.5.7
  • Modify docker-image/Dockerfile to change FROM alpine:3.4 to FROM s390x/alpine:3.6

  • Build the binaries and docker image for typha

    make calico/typha
2.8 Build calico-bgp-daemon
   git clone https://github.com/projectcalico/calico-bgp-daemon $GOPATH/src/github.com/projectcalico/calico-bgp-daemon
   cd $GOPATH/src/github.com/projectcalico/calico-bgp-daemon
   git checkout v0.2.2

Modify Dockerfile to change FROM alpine:3.4 to FROM s390x/alpine:3.6 and run

   make build-containerized
2.9 Build image calico/node
   git clone https://github.com/projectcalico/calico $GOPATH/src/github.com/projectcalico/calico
   cd $GOPATH/src/github.com/projectcalico/calico
   git checkout v2.6.9

Modify calico_node/Makefile

@@ -202,7 +202,7 @@ $(NODE_CONTAINER_BIN_DIR)/confd:
        -docker rm -f calico-confd
        # Latest confd binaries are stored in automated builds of calico/confd.
        # To get them, we create (but don't start) a container from that image.
-       docker pull $(CONFD_CONTAINER_NAME)
+       #docker pull $(CONFD_CONTAINER_NAME)
        docker create --name calico-confd $(CONFD_CONTAINER_NAME)
        # Then we copy the files out of the container.  Since docker preserves
        # mtimes on its copy, check the file really did appear, then touch it
@@ -238,7 +238,7 @@ $(NODE_CONTAINER_BIN_DIR)/allocate-ipip-addr: dist/allocate-ipip-addr
 ## Build startup.go
 .PHONY: startup
 startup:
-       GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -v -i -o dist/startup $(LDFLAGS) startup/startup.go
+       GOOS=linux GOARCH=s390x CGO_ENABLED=0 go build -v -i -o dist/startup $(LDFLAGS) startup/startup.go

 dist/startup: $(STARTUP_FILES) vendor
        mkdir -p dist
@@ -257,7 +257,7 @@ dist/startup: $(STARTUP_FILES) vendor
 ## Build allocate_ipip_addr.go
 .PHONY: allocate-ipip-addr
 allocate-ipip-addr:
-       GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -v -i -o dist/allocate-ipip-addr $(LDFLAGS) allocateipip/allocate_ipip_addr.go
+       GOOS=linux GOARCH=s390x CGO_ENABLED=0 go build -v -i -o dist/allocate-ipip-addr $(LDFLAGS) allocateipip/allocate_ipip_addr.go

 dist/allocate-ipip-addr: $(ALLOCATE_IPIP_FILES) vendor
        mkdir -p dist
@@ -320,11 +320,11 @@ certs/.certificates.created:
        touch certs/.certificates.created

 busybox.tar:
-       docker pull busybox:latest
+       #docker pull busybox:latest
        docker save --output busybox.tar busybox:latest

 routereflector.tar:
-       docker pull calico/routereflector:$(RR_VER)
+       #docker pull calico/routereflector:$(RR_VER)
        docker save --output routereflector.tar calico/routereflector:$(RR_VER)

 workload.tar:
@@ -639,17 +639,17 @@ $(RELEASE_DIR_IMAGES)/calico-node.tar:

 $(RELEASE_DIR_IMAGES)/calico-typha.tar:
        mkdir -p $(RELEASE_DIR_IMAGES)
-       docker pull calico/typha:$(TYPHA_VER)
+       #docker pull calico/typha:$(TYPHA_VER)
        docker save --output $@ calico/typha:$(TYPHA_VER)

 $(RELEASE_DIR_IMAGES)/calico-cni.tar:
        mkdir -p $(RELEASE_DIR_IMAGES)
-       docker pull calico/cni:$(CNI_VER)
+       #docker pull calico/cni:$(CNI_VER)
        docker save --output $@ calico/cni:$(CNI_VER)

 $(RELEASE_DIR_IMAGES)/calico-kube-controllers.tar:
        mkdir -p $(RELEASE_DIR_IMAGES)
-       docker pull calico/kube-controllers:$(KUBE_CONTROLLERS_VER)
+       #docker pull calico/kube-controllers:$(KUBE_CONTROLLERS_VER)
        docker save --output $@ calico/kube-controllers:$(KUBE_CONTROLLERS_VER)

 $(RELEASE_DIR_BIN)/%:

Modify calico_node/Dockerfile

@@ -11,27 +11,14 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-FROM alpine
+FROM s390x/alpine:3.6
 MAINTAINER Tom Denham <tom@projectcalico.org>

 # Set the minimum Docker API version required for libnetwork.
 ENV DOCKER_API_VERSION 1.21

-# Download and install glibc for use by non-static binaries that require it.
-RUN apk --no-cache add wget ca-certificates libgcc && \
-    wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://raw.githubusercontent.com/sgerrand/alpine-pkg-glibc/master/sgerrand.rsa.pub && \
-    wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.23-r3/glibc-2.23-r3.apk && \
-    wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.23-r3/glibc-bin-2.23-r3.apk && \
-    apk add glibc-2.23-r3.apk glibc-bin-2.23-r3.apk && \
-    /usr/glibc-compat/sbin/ldconfig /lib /usr/glibc/usr/lib && \
-    apk del wget && \
-    rm -f glibc-2.23-r3.apk glibc-bin-2.23-r3.apk
-
-# Install runit from the community repository, as its not yet available in global
-RUN apk add --no-cache --repository "http://alpine.gliderlabs.com/alpine/edge/community" runit
-
 # Install remaining runtime deps required for felix from the global repository
-RUN apk add --no-cache ip6tables ipset iputils iproute2 conntrack-tools
+RUN apk add --no-cache ip6tables ipset iputils iproute2 conntrack-tools runit file

 # Copy in the filesystem - this contains felix, bird, calico-bgp-daemon etc...
 COPY filesystem /

Get the yaml binary if not installed, needed for building calico/node

   go get github.com/mikefarah/yaml
   export PATH=$PATH:$GOPATH/bin

Build calico/node

   cd $GOPATH/src/github.com/projectcalico/calico/calico_node
   make dist/calicoctl
   mkdir filesystem/bin
   cp $GOPATH/src/github.com/projectcalico/bird/dist/s390x/* filesystem/bin
   cp $GOPATH/src/github.com/projectcalico/confd/bin/confd filesystem/bin
   cp $GOPATH/src/github.com/projectcalico/libnetwork-plugin/dist/libnetwork-plugin filesystem/bin
   cp $GOPATH/src/github.com/projectcalico/felix/bin/calico-felix filesystem/bin
   cp $GOPATH/src/github.com/projectcalico/calico-bgp-daemon/dist/* filesystem/bin
   make calico/node
2.10 Start calico/node
  1. First start etcd that is required by running calico/node
   etcd --listen-client-urls=http://<host-ip>:2379 --advertise-client-urls=http://<host-ip>:2379
  1. Tag image calico/node to quay.io/calico/node
   docker tag  calico/node quay.io/calico/node:v2.6.9
  1. Start calico/node
   cd  $GOPATH/src/github.com/projectcalico/calico/calico_node
   ETCD_ENDPOINTS=http://<host_run_etcd_ip>:2379 dist/calicoctl node run --node-image=quay.io/calico/node:v2.6.9

Check the output and confirm that calico/node is successfully started.

2.11 Calico testcases (Optional)

  • Build etcd

    cd $GOPATH/src/github.com/projectcalico/
    git clone https://github.com/coreos/etcd
    cd etcd
    git checkout v3.3.1
    

    Modify Dockerfile-release for s390x

    @@ -1,7 +1,9 @@
    -FROM alpine:latest
    +FROM s390x/alpine:3.6
    +
    +ADD bin/etcd /usr/local/bin/
    +ADD bin/etcdctl /usr/local/bin/
    +ENV ETCD_UNSUPPORTED_ARCH=s390x
    
    -ADD etcd /usr/local/bin/
    -ADD etcdctl /usr/local/bin/
    RUN mkdir -p /var/etcd/
    RUN mkdir -p /var/lib/etcd/
    

    Then build etcd and image

    ./build
    docker build -f Dockerfile-release  -t quay.io/coreos/etcd .
    cd bin
    tar cvf etcd-v3.3.1-linux-s390x.tar etcd etcdctl
    gzip etcd-v3.3.1-linux-s390x.tar
    
  • Build CNI plugins binaries and CNI image

    sudo mkdir -p /opt/cni/bin
    git clone https://github.com/projectcalico/cni-plugin.git $GOPATH/src/github.com/projectcalico/cni-plugin
    cd $GOPATH/src/github.com/projectcalico/cni-plugin
    git checkout v1.11.5
    mkdir dist
    
  • Modify Dockerfile to change FROM busybox to FROM s390x/busybox

    Modify Makefile as follows

    @@ -111,7 +111,7 @@ fetch-cni-bins: dist/flannel dist/loopback dist/host-local dist/portmap
    
     dist/flannel dist/loopback dist/host-local dist/portmap:
            mkdir -p dist
    -       $(CURL) -L --retry 5 https://github.com/containernetworking/plugins/releases/download/$(CNI_VERSION)/cni-plugins-amd64-$(CNI_VERSION).tgz | tar -xz -C dist ./flannel ./loopback ./host-local ./portmap
    +       $(CURL) -L --retry 5 https://github.com/containernetworking/plugins/releases/download/$(CNI_VERSION)/cni-plugins-s390x-$(CNI_VERSION).tgz | tar -xz -C dist ./flannel ./loopback ./host-local ./portmap
    
     # Useful for CI but currently slow for local development because the
     # .go-pkg-cache can't be used (since tests run as root)

    Then build CNI binaries and image

    make docker-image
    sudo cp dist/* /opt/cni/bin
    docker tag calico/cni:latest quay.io/calico/cni:v1.11.5
    
  • Build calico/routereflector

    git clone https://github.com/projectcalico/bird.git $GOPATH/src/github.com/projectcalico/routereflector
    cd $GOPATH/src/github.com/projectcalico/routereflector
    git checkout rr-v0.4.2
    cd build_routereflector/
    cp $GOPATH/src/github.com/projectcalico/bird/dist/s390x/* image/
    cp $GOPATH/src/github.com/projectcalico/confd/bin/confd  image/
    docker tag calico/confd calico/confd:v1.0.0-beta1-4-g4619952

    Modify Dockerfile as follows

    @@ -14,7 +14,10 @@
    
    # For details and docs - see https://github.com/phusion/baseimage-docker#getting_started
    
    -FROM ubuntu:14.04
    +FROM s390x/ubuntu:16.04
    +
    +RUN apt-get update && \
    +       apt-get install -y python3-minimal
    
    CMD ["/sbin/my_init"]
    

    Modify image/install.sh as follows

    @@ -19,25 +19,23 @@ $minimal_apt_get_install software-properties-common
     # Install curl, needed below for manual BIRD install.
     $minimal_apt_get_install curl
    
    -# Find the list of packages just installed - these can be deleted later.
    -grep -Fxvf  /tmp/base.txt <(dpkg -l | grep ^ii | sed 's_  _\t_g' | cut \
    --f 2) >/tmp/add-apt.txt
    -
    -# Add new repos and update again
    -LC_ALL=C.UTF-8 LANG=C.UTF-8 add-apt-repository -y ppa:cz.nic-labs/bird
    -apt-get update
    
     # Install packages that should not be removed in the cleanup processing.
     # - bird and bird6
     # - packages required by felix
     # - pip (which includes various setuptools package discovery).
     $minimal_apt_get_install \
    -        bird \
    -        bird6
    +        bird
    +
    +cp build/bir* /usr/sbin/
    
     # Install Confd
    -curl -L https://github.com/projectcalico/confd/releases/download/v0.12.1-calico-0.4.3/confd -o confd
    -chmod +x confd
    +#curl -L https://github.com/projectcalico/confd/releases/download/v0.12.1-calico-0.4.3/confd -o confd
    +#chmod +x confd
    +cp build/confd /
    +chmod +x /confd
    +
    +apt-get install -y python3
    
     # Create the config directory for confd
     mkdir config  

    Modify image/cleanup.sh as follows

    @@ -5,8 +5,6 @@ set -x
     # Remove extra packages using dpkg rather than apt-get - this prevents us from
     # deleting dependent packages that we still require.
     # - Remove any temporary packages installed in the install.sh script.
    -echo "Removing extra packages"
    -cat /tmp/add-apt.txt | xargs xargs dpkg -r --force-depends
    
     # Remove any other junk created during installation that is not required.
     apt-get clean
    

    Build the routereflector

    cd $GOPATH/src/github.com/projectcalico/routereflector/build_routereflector/
    make
    docker tag calico/routereflector:latest calico/routereflector:v0.4.2
    
  • Build calico/dind

    git clone https://github.com/projectcalico/dind $GOPATH/src/github.com/projectcalico/dind
    cd $GOPATH/src/github.com/projectcalico/dind
    

    Create Dockerfile-s390x with following content

    FROM s390x/docker:18.03.0-dind
    MAINTAINER LoZ Open Source Ecosystem (https://www.ibm.com/developerworks/community/groups/community/lozopensource)
    
    RUN apk add --update iptables ip6tables ipset iproute2 curl busybox-extras && \
    echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' >> /etc/nsswitch.conf && \
    rm -rf /var/cache/apk/*
    

    Build the dind

    docker build -t calico/dind -f Dockerfile-s390x .
    
  • Build calico/test

    cd $GOPATH/src/github.com/projectcalico/calico/calico_node/calico_test/
    mkdir pkg
    cp $GOPATH/src/github.com/projectcalico/etcd/bin/etcd-v3.3.1-linux-s390x.tar.gz pkg
    

    Modify the Dockerfile.calico_test as follows

    @@ -32,7 +32,7 @@
    # - eliminate most isolation, (--uts=host --pid=host --net=host --privileged)
    # - volume mount your ST source code
    # - run 'nosetests'
    -FROM docker:1.13.0
    +FROM s390x/docker:18.03.0
    MAINTAINER Tom Denham <tom@projectcalico.org>
    
    # Running STs in this container requires that it has all dependencies installed
    @@ -45,11 +45,13 @@ RUN apk add --update python python-dev py2-pip py-setuptools openssl-dev libffi-
    COPY requirements.txt /requirements.txt
    RUN pip install -r /requirements.txt
    
    +RUN apk update \
    +&&   apk add ca-certificates wget \
    +&&   update-ca-certificates
    +
    # Install etcdctl
    -RUN wget https://github.com/coreos/etcd/releases/download/v2.3.3/etcd-v2.3.3-linux-amd64.tar.gz && \
    -    tar -xzf etcd-v2.3.3-linux-amd64.tar.gz && \
    -    cd etcd-v2.3.3-linux-amd64 && \
    -    ln -s etcdctl /usr/local/bin/
    +COPY pkg /pkg/
    +RUN tar -xzf pkg/etcd-v3.3.1-linux-s390x.tar.gz -C /usr/local/bin/
    
    # The container is used by mounting the code-under-test to /code
    WORKDIR /code/
    
  • Run the test cases

    cd $GOPATH/src/github.com/projectcalico/calico/calico_node
    cp dist/calicoctl dist/calicoctl-v1.0.2
    docker pull s390x/busybox
    docker tag s390x/busybox busybox
    docker pull s390x/nginx
    docker tag s390x/nginx nginx
    docker tag calico/routereflector calico/routereflector:v0.4.2
    docker tag calico/cni calico/cni:v1.11.5

    Modify workload/Dockerfile

    @@ -1,4 +1,4 @@
    -FROM alpine:3.4
    +FROM s390x/alpine:3.6
    RUN apk add --no-cache \
       python \
       netcat-openbsd

    Run test cases

    make st
    

3. Calico Integration

References:

https://github.com/projectcalico