From 5dca63ca7a0b937b7e29669db7a7dff6398fbed0 Mon Sep 17 00:00:00 2001 From: Jason DeTiberus Date: Fri, 4 May 2018 01:45:13 -0400 Subject: [PATCH] Add calico networking Signed-off-by: Jason DeTiberus --- .circleci/config.yml | 24 +++++++++++++++++++ .gitignore | 1 + Makefile | 8 ++++++- README.md | 9 +++++-- test/cases/000_smoke/005_cri-calico/test.sh | 9 +++++++ .../cases/000_smoke/006_docker-calico/test.sh | 9 +++++++ yml/calico.yml | 3 +++ 7 files changed, 60 insertions(+), 3 deletions(-) create mode 100755 test/cases/000_smoke/005_cri-calico/test.sh create mode 100755 test/cases/000_smoke/006_docker-calico/test.sh create mode 100644 yml/calico.yml diff --git a/.circleci/config.yml b/.circleci/config.yml index fc4e7df..bf0ba68 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -217,6 +217,13 @@ jobs: environment: - KUBE_RUNTIME: docker - KUBE_NETWORK: bridge + image-docker-calico: + <<: *image_build + # Needs to be configured/enabled by CircleCI person + #resource_class: large + environment: + - KUBE_RUNTIME: docker + - KUBE_NETWORK: calico image-cri-containerd-weave: <<: *image_build @@ -228,6 +235,11 @@ jobs: environment: - KUBE_RUNTIME: cri-containerd - KUBE_NETWORK: bridge + image-cri-containerd-calico: + <<: *image_build + environment: + - KUBE_RUNTIME: cri-containerd + - KUBE_NETWORK: calico push-pkgs-to-hub: docker: @@ -310,6 +322,12 @@ workflows: - pkg-kubelet - pkg-kubernetes-docker-image-cache-common - pkg-kubernetes-docker-image-cache-control-plane + - image-docker-calilco: + requires: + - dependencies + - pkg-kubelet + - pkg-kubernetes-docker-image-cache-common + - pkg-kubernetes-docker-image-cache-control-plane - image-cri-containerd-weave: requires: - dependencies @@ -318,6 +336,10 @@ workflows: requires: - dependencies - pkg-kubelet + - image-cri-containerd-calico: + requires: + - dependencies + - pkg-kubelet - push-pkgs-to-hub: # We want everything to have passed, which is a bit @@ -331,5 +353,7 @@ workflows: - pkg-kubernetes-docker-image-cache-control-plane - image-docker-weave - image-docker-bridge + - image-docker-calico - image-cri-containerd-weave - image-cri-containerd-bridge + - image-cri-containerd-calico diff --git a/.gitignore b/.gitignore index d8f30c0..477b9c7 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ kube-*-cmdline kube-*-initrd.img kube-*-state kube-weave.yaml +kube-calico.yaml diff --git a/Makefile b/Makefile index e414bc4..6dea15e 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ KUBE_RUNTIME ?= docker KUBE_NETWORK ?= weave KUBE_NETWORK_WEAVE ?= v2.2.1 +KUBE_NETWORK_CALICO ?= v3.1 ifeq ($(shell uname -s),Darwin) KUBE_FORMATS ?= iso-efi @@ -27,6 +28,11 @@ yml/weave.yml: kube-weave.yaml kube-weave.yaml: curl -L -o $@ https://cloud.weave.works/k8s/v1.8/net?v=$(KUBE_NETWORK_WEAVE) +yml/calico.yml: kube-calico.yaml + +kube-calico.yaml: + curl -L -o $@ https://docs.projectcalico.org/${KUBE_NETWORK_CALICO}/getting-started/kubernetes/installation/hosted/kubeadm/1.7/calico.yaml + .PHONY: update-hashes update-hashes: set -e ; for tag in $$(linuxkit pkg show-tag pkg/kubelet) \ @@ -40,7 +46,7 @@ update-hashes: clean: rm -f -r \ kube-*-kernel kube-*-cmdline kube-*-state kube-*-initrd.img *.iso \ - kube-weave.yaml + kube-weave.yaml kube-calico.yaml .PHONY: refresh-image-caches refresh-image-caches: diff --git a/README.md b/README.md index 5522c80..0c5df37 100644 --- a/README.md +++ b/README.md @@ -28,9 +28,9 @@ To build the default OS images: make all ``` -By default this will build images using Docker Engine for execution. To instead use cri-containerd use: +By default this will build images using Docker Engine for execution and weave for networking. To instead use cri-containerd and calico use: ``` -make all KUBE_RUNTIME=cri-containerd +make all KUBE_RUNTIME=cri-containerd KUBE_NETWORK=calico ``` ## Booting and initialising OS images @@ -44,6 +44,11 @@ or, to automatically initialise the cluster upon boot with no additional options KUBE_MASTER_AUTOINIT="" ./boot.sh ``` +If using calico for networking: +``` +KUBE_MASTER_AUTOINIT="--pod-network-cidr=192.168.0.0/16" ./boot.sh +``` + Get IP address of the master: ``` ip addr show dev eth0 diff --git a/test/cases/000_smoke/005_cri-calico/test.sh b/test/cases/000_smoke/005_cri-calico/test.sh new file mode 100755 index 0000000..5ffddb1 --- /dev/null +++ b/test/cases/000_smoke/005_cri-calico/test.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# SUMMARY: build and boot using cri-containerd runtime and Calico networking +# LABELS: + +runtime=cri-containerd +network=calico + +# Doesn't return +. ../common.sh diff --git a/test/cases/000_smoke/006_docker-calico/test.sh b/test/cases/000_smoke/006_docker-calico/test.sh new file mode 100755 index 0000000..2dc343d --- /dev/null +++ b/test/cases/000_smoke/006_docker-calico/test.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# SUMMARY: build and boot using Docker runtime and Calico networking +# LABELS: + +runtime=docker +network=calico + +# Doesn't return +. ../common.sh diff --git a/yml/calico.yml b/yml/calico.yml new file mode 100644 index 0000000..24cd5a5 --- /dev/null +++ b/yml/calico.yml @@ -0,0 +1,3 @@ +files: + - path: /etc/kubeadm/kube-system.init/50-calico.yaml + source: kube-calico.yaml