kubernetes: Refactor network provider selection

KUBE_NETWORK now specifies a yml which is passed to the Moby tool, which can
introduce files into /etc/kubeadm/kube-system.init/ or do other things as it
likes.

In the case of weave this just adds the weave yaml to that directory. To avoid
too much confusion between weave.yml (Moby tool input) and `weave.yaml` (the
kubernetes `ServiceAccount`, `DeamonsSet` etc object specs) name the latter
`kube-weave.yaml`.

Signed-off-by: Ian Campbell <ijc@docker.com>
This commit is contained in:
Ian Campbell 2017-11-09 11:34:26 +00:00
parent 22cdd22184
commit ed0e79aa9d
4 changed files with 15 additions and 16 deletions

View File

@ -2,5 +2,4 @@ image-cache/common/*.tar
image-cache/common/Dockerfile
image-cache/control-plane/*.tar
image-cache/control-plane/Dockerfile
weave.yaml
network.yaml
kube-weave.yaml

View File

@ -1,8 +1,7 @@
KUBE_RUNTIME ?= docker
KUBE_NETWORK ?= weave-v2.0.5
KUBE_NETWORK ?= weave
INIT_YAML ?=
INIT_YAML += network.yaml
KUBE_NETWORK_WEAVE ?= v2.0.5
ifeq ($(shell uname -s),"Darwin")
KUBE_FORMATS ?= iso-efi
@ -25,21 +24,19 @@ push-container-images:
build-vm-images: kube-master.iso kube-node.iso
# NB cannot use $^ because $(INIT_YAML) is not for consumption by "moby build"
kube-master.iso: kube.yml $(KUBE_RUNTIME).yml $(KUBE_RUNTIME)-master.yml $(INIT_YAML)
moby build -name kube-master $(KUBE_FORMAT_ARGS) kube.yml $(KUBE_RUNTIME).yml $(KUBE_RUNTIME)-master.yml
kube-master.iso: kube.yml $(KUBE_RUNTIME).yml $(KUBE_RUNTIME)-master.yml $(KUBE_NETWORK).yml
moby build -name kube-master $(KUBE_FORMAT_ARGS) $^
kube-node.iso: kube.yml $(KUBE_RUNTIME).yml
kube-node.iso: kube.yml $(KUBE_RUNTIME).yml $(KUBE_NETWORK).yml
moby build -name kube-node $(KUBE_FORMAT_ARGS) $^
network.yaml: $(KUBE_NETWORK).yaml
ln -nf $< $@
weave.yml: kube-weave.yaml
weave-%.yaml:
curl -L -o $@ https://cloud.weave.works/k8s/v1.8/net?v=$*
kube-weave.yaml:
curl -L -o $@ https://cloud.weave.works/k8s/v1.8/net?v=$(KUBE_NETWORK_WEAVE)
clean:
rm -f -r \
kube-*-kernel kube-*-cmdline kube-*-state kube-*-initrd.img *.iso \
weave-*.yaml network.yaml
kube-weave.yaml
$(MAKE) -C image-cache clean

View File

@ -47,8 +47,8 @@ files:
PRETTY_NAME="LinuxKit Kubernetes Project"
- path: /usr/libexec/kubernetes/kubelet-plugins
symlink: "/var/lib/kubelet-plugins"
- path: /etc/kubeadm/kube-system.init/50-network.yaml
source: network.yaml
- path: /etc/kubeadm/
directory: true
- path: /etc/sysctl.d/01-kubernetes.conf
contents: 'net.ipv4.ip_forward = 1'
- path: /opt/cni

View File

@ -0,0 +1,3 @@
files:
- path: /etc/kubeadm/kube-system.init/50-weave.yaml
source: weave-sa.yaml