-
Notifications
You must be signed in to change notification settings - Fork 1
Building_Calico_v3.0.4
The instructions specify the steps to build Calico
version v3.0.4 on Linux on IBM Z for following distributions:
- RHEL (7.3, 7.4)
- SLES (12 SP2, 12 SP3)
- Ubuntu (16.04, 17.10, 18.04)
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.
- Go -- Instructions for building Go can be found here.
- Docker -- Instructions for install Docker can be found here (Docker-ce versions 17.06 - 18.02 have a known issue. Use Docker-ce version 18.03 and above or if you need to use an older version of docker, use 17.05 and below)
- etcd -- Instructions for building etcd can be found here
-
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
-
This builds a docker image
calico/go-build
that is used to build other componentscd /<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
-
Create
Dockerfile.s390x
with following contentFROM 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"]
-
Modify
Makefile
as follows@@ -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 .
-
Then build
calico/go-build-s390x
imagemake calico/go-build-s390x docker tag calico/go-build-s390x:latest calico/go-build:latest
-
Download the source code
git clone https://github.com/projectcalico/calicoctl $GOPATH/src/github.com/projectcalico/calicoctl cd $GOPATH/src/github.com/projectcalico/calicoctl git checkout v2.0.2
-
Modify
Makefile
as follows@@ -25,6 +25,12 @@ ifeq ($(ARCH),ppc64le) GO_BUILD_VER:=latest endif +ifeq ($(ARCH),s390x) + ARCHTAG:=-s390x + GO_BUILD_VER:=latest +endif + + # Determine which OS. OS := $(shell uname -s | tr A-Z a-z) @@ -98,6 +104,9 @@ dist/calicoctl-linux-amd64: $(CALICOCTL_FILES) vendor dist/calicoctl-linux-ppc64le: $(CALICOCTL_FILES) vendor $(MAKE) OS=linux ARCH=ppc64le ARCHTAG=$(ARCHTAG) binary-containerized +dist/calicoctl-linux-s390x: $(CALICOCTL_FILES) vendor + $(MAKE) OS=linux ARCH=s390x ARCHTAG=$(ARCHTAG) binary-containerized + dist/calicoctl-darwin-amd64: $(CALICOCTL_FILES) vendor $(MAKE) OS=darwin ARCH=amd64 ARCHTAG=$(ARCHTAG) binary-containerized
-
Change directory to
calicoctl
foldercd calicoctl
-
Create
Dockerfile.calicoctl-s390x
with following contentFROM s390x/alpine:3.6 MAINTAINER LoZ Open Source Ecosystem (https://www.ibm.com/developerworks/community/groups/community/lozopensource) ADD dist/calicoctl-linux-s390x ./calicoctl ENV CALICO_CTL_CONTAINER=TRUE ENV PATH=$PATH:/ WORKDIR /root ENTRYPOINT ["/calicoctl"]
-
Build the
calicoctl
binary andcalico/ctl
imagecd $GOPATH/src/github.com/projectcalico/calicoctl ARCH=s390x make calico/ctl docker tag calico/ctl-s390x:latest calico/ctl:v2.0.2
-
Download the source code
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 contentFROM 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 (indist/s390x/
)ARCH=s390x ./build.sh
-
Download the source code
git clone https://github.com/projectcalico/confd $GOPATH/src/github.com/projectcalico/confd cd $GOPATH/src/github.com/projectcalico/confd git checkout v1.0.3
-
Modify
Dockerfile
to changeFROM alpine
toFROM s390x/alpine:3.6
-
Build the
confd
binariesARCH=s390x make container
-
Download the source code
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.0
-
Modify
Dockerfile
to changeFROM alpine:latest
toFROM s390x/alpine:3.6
and build -
Build
libnetwork-plugin
make calico/libnetwork-plugin
-
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.6.2
-
Modify
Makefile
as follows@@ -13,6 +13,11 @@ ifeq ($(ARCH),ppc64le) GO_BUILD_VER?=latest endif +ifeq ($(ARCH),s390x) + ARCHTAG:=-s390x + GO_BUILD_VER?=latest +endif + help: @echo "Typha Makefile" @echo
-
Create
docker-image/Dockerfile-s390x
with following contentFROM 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 add --update tini ENTRYPOINT ["/sbin/tini", "--"] ADD typha.cfg /etc/calico/typha.cfg # Put out binary in /code rather than directly in /usr/bin. This allows the downstream builds # to more easily extract the build artefacts from the container. RUN mkdir /code ADD bin/calico-typha-s390x /code WORKDIR /code RUN ln -s /code/calico-typha-s390x /usr/bin/calico-typha # Run Typha by default CMD ["calico-typha"]
-
Build the binaries and docker image for typha
cd $GOPATH/src/github.com/projectcalico/typha ARCH=s390x make calico/typha
-
To build
felix
it needsfelixbackend.pb.go
that is generated by a docker imagecalico/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
-
Create Dockerfile named
Dockerfile-s390x
with following contentFROM s390x/golang:1.9.2 MAINTAINER LoZ Open Source Ecosystem (https://www.ibm.com/developerworks/community/groups/community/lozopensource) ADD . /src WORKDIR /src ENV PROTOBUF_TAG v3.4.1 RUN ./build.sh ENTRYPOINT ["protoc"]
-
Build docker image
calico/protoc-s390x
docker build -t calico/protoc-s390x -f Dockerfile-s390x .
-
Build
felix
-
RHEL (7.3, 7.4)
git clone https://github.com/projectcalico/felix $GOPATH/src/github.com/projectcalico/felix cd $GOPATH/src/github.com/projectcalico/felix git checkout 3.0.3
-
Modify
Makefile
as follows@@ -58,6 +58,12 @@ ifeq ($(ARCH),ppc64le) FV_TYPHAIMAGE?=calico/typha-ppc64le:latest endif +ifeq ($(ARCH),s390x) + ARCHTAG:=-s390x + GO_BUILD_VER?=latest + FV_TYPHAIMAGE?=calico/typha-s390x:latest +endif + GO_BUILD_CONTAINER?=calico/go-build$(ARCHTAG):$(GO_BUILD_VER) FV_ETCDIMAGE?=quay.io/coreos/etcd:v3.2.5$(ARCHTAG) FV_K8SIMAGE?=gcr.io/google_containers/hyperkube$(ARCHTAG):v1.7.5
-
Change directory to
docker-image
foldercd docker-image
-
Create
Dockerfile-s390x
with following contentFROM 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 ADD calico-felix-wrapper usr/bin # 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-wrapper"]
-
-
SLES (12 SP2, 12 SP3) and Ubuntu (16.04, 17.10, 18.04)
Note: In Felix version 3.0.3, there is an issue 'unable to program iptables' observed while running System tests on SLES and Ubuntu distributions due to introduction of xt_ipvs module, which has been fixed in felix version 3.1.0-rc1. For details refer issue.
git clone https://github.com/projectcalico/felix $GOPATH/src/github.com/projectcalico/felix cd $GOPATH/src/github.com/projectcalico/felix git checkout 3.1.0-rc1
-
Modify
Makefile
as follows@@ -63,6 +63,7 @@ endif ifeq ($(ARCH),s390x) ARCHTAG:=-s390x GO_BUILD_VER?=latest + PROTOC_VER?=latest FV_TYPHAIMAGE?=calico/typha-s390x:latest endif
-
-
-
Build the felix binaries
cd $GOPATH/src/github.com/projectcalico/felix ARCH=s390x make calico/felix
-
Download the source code
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.1
-
Modify
Dockerfile
to changeFROM alpine:3.4
toFROM s390x/alpine:3.6
and runmake build-containerized
-
Download the source
git clone https://github.com/projectcalico/calico $GOPATH/src/github.com/projectcalico/calico cd $GOPATH/src/github.com/projectcalico/calico git checkout v3.0.4
-
Modify
calico_node/Makefile
as follows@@ -137,7 +137,7 @@ dist/calicoctl-v1.0.2: # variables. These are used for the STs. dist/calicoctl: -docker rm -f calicoctl - docker pull $(CTL_CONTAINER_NAME) +# docker pull $(CTL_CONTAINER_NAME) docker create --name calicoctl $(CTL_CONTAINER_NAME) docker cp calicoctl:calicoctl dist/calicoctl && \ test -e dist/calicoctl && \ @@ -145,7 +145,7 @@ dist/calicoctl: -docker rm -f calicoctl dist/calico-cni-plugin dist/calico-ipam-plugin: -docker rm -f calico-cni - docker pull calico/cni:$(CNI_VER) + #docker pull calico/cni:$(CNI_VER) docker create --name calico-cni calico/cni:$(CNI_VER) docker cp calico-cni:/opt/cni/bin/calico dist/calico-cni-plugin && \ test -e dist/calico-cni-plugin && \ @@ -198,7 +198,7 @@ $(NODE_CONTAINER_BIN_DIR)/calico-felix update-felix: -docker rm -f calico-felix # Latest felix binaries are stored in automated builds of calico/felix. # To get them, we create (but don't start) a container from that image. - if $(PULL_FELIX); then docker pull $(FELIX_CONTAINER_NAME); fi + #if $(PULL_FELIX); then ndocker pull $(FELIX_CONTAINER_NAME); fi docker create --name calico-felix $(FELIX_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 @@ -213,7 +213,7 @@ $(NODE_CONTAINER_BIN_DIR)/libnetwork-plugin: -docker rm -f calico-$(@F) # Latest libnetwork-plugin binaries are stored in automated builds of calico/libnetwork-plugin. # To get them, we pull that image, then copy the binaries out to our host - docker pull $(LIBNETWORK_PLUGIN_CONTAINER_NAME) + #docker pull $(LIBNETWORK_PLUGIN_CONTAINER_NAME) docker create --name calico-$(@F) $(LIBNETWORK_PLUGIN_CONTAINER_NAME) docker cp calico-$(@F):/$(@F) $(@D) -docker rm -f calico-$(@F) @@ -223,7 +223,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 @@ -259,7 +259,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 @@ -278,7 +278,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 @@ -341,11 +341,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: @@ -479,7 +479,7 @@ run-k8s-apiserver: stop-k8s-apiserver run-etcd vendor docker run \ --net=host --name st-apiserver \ --detach \ - gcr.io/google_containers/hyperkube-amd64:${K8S_VERSION} \ + gcr.io/google_containers/hyperkube-s390x:${K8S_VERSION} \ /hyperkube apiserver \ --bind-address=0.0.0.0 \ --insecure-bind-address=0.0.0.0 \ @@ -666,17 +666,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
as follows@@ -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...
-
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
docker tag calico/go-build calico/go-build:v0.9 docker tag calico/libnetwork-plugin calico/libnetwork-plugin:v1.1.0 docker tag calico/felix-s390x calico/felix:3.0.3 docker tag calico/confd calico/confd:v1.0.3 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/calico-bgp-daemon/dist/* filesystem/bin make calico/node
-
First start
etcd
that is required by runningcalico/node
etcd --listen-client-urls=http://<host-ip>:2379 --advertise-client-urls=http://<host-ip>:2379
-
Tag image
calico/node
toquay.io/calico/node
docker tag calico/node quay.io/calico/node:v3.0.4
-
Start
calico/node
cd $GOPATH/src/github.com/projectcalico/calico/calico_node sudo ETCD_ENDPOINTS=http://<host_run_etcd_ip>:2379 dist/calicoctl node run --node-image=quay.io/calico/node:v3.0.4
Check the output and confirm that calico/node
is successfully started.
-
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 v2.0.3 mkdir dist
Create
Dockerfile-s390x
with following contentFROM s390x/busybox LABEL maintainer "Tom Denham <tom@tigera.io>" ADD dist/s390x/calico /opt/cni/bin/calico ADD dist/s390x/flannel /opt/cni/bin/flannel ADD dist/s390x/loopback /opt/cni/bin/loopback ADD dist/s390x/host-local /opt/cni/bin/host-local ADD dist/s390x/portmap /opt/cni/bin/portmap ADD dist/s390x/calico-ipam /opt/cni/bin/calico-ipam ADD k8s-install/scripts/install-cni.sh /install-cni.sh ADD k8s-install/scripts/calico.conf.default /calico.conf.tmp ENV PATH=$PATH:/opt/cni/bin VOLUME /opt/cni WORKDIR /opt/cni/bin CMD ["/opt/cni/bin/calico"]
Make changes to
Makefile
@@ -13,6 +13,11 @@ ifeq ($(ARCH),ppc64le) GO_BUILD_VER:=latest endif +ifeq ($(ARCH),s390x) + ARCHTAG:=-s390x + GO_BUILD_VER:=latest +endif + # Disable make's implicit rules, which are not useful for golang, and slow down the build # considerably. .SUFFIXES:
Make changes to
.dockerignore
@@ -13,3 +13,9 @@ !dist/ppc64le/loopback !dist/ppc64le/host-local !dist/ppc64le/portmap +!dist/s390x/calico +!dist/s390x/calico-ipam +!dist/s390x/flannel +!dist/s390x/loopback +!dist/s390x/host-local +!dist/s390x/portmap
Then
ARCH=s390x make docker-image sudo cp dist/s390x/* /opt/cni/bin docker tag calico/cni-s390x:latest quay.io/calico/cni:v2.0.3
-
Build
calico/routereflector
git clone https://github.com/projectcalico/routereflector.git $GOPATH/src/github.com/projectcalico/routereflector cd $GOPATH/src/github.com/projectcalico/routereflector git checkout v0.5.0 cp $GOPATH/src/github.com/projectcalico/bird/dist/s390x/* image/ docker tag calico/confd:v1.0.3 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
Makefile
as follows@@ -23,7 +23,7 @@ dist/confd: dist -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
Modify
image/install.sh
as follows@@ -16,10 +16,6 @@ $minimal_apt_get_install apt-transport-https ca-certificates # Install add-apt-repository $minimal_apt_get_install software-properties-common -# 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 @@ -29,8 +25,7 @@ apt-get update # - packages required by felix # - pip (which includes various setuptools package discovery). $minimal_apt_get_install \ - bird \ - bird6 + bird # 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 make docker tag calico/routereflector:latest calico/routereflector:v0.5.0
-
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 contentFROM 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.5.0 docker tag calico/cni-s390x calico/cni:v2.0.3
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