kubernetes: Only build the relevant image for the platform

Building both BIOS and EFI variants is a waste of time in most cases, instead
just build whichever one is relevant to the platform (which currently means EFI
on Darwin and BIOS everywhere else).

At the same time make it possible to pass "KUBE_FORMATS" (a space separated
list of targets) to the build e.g. `make KUBE_FORMATS="iso-efi iso-bios"` will
preserve the behaviour prior to this patch.

Signed-off-by: Ian Campbell <ijc@docker.com>
This commit is contained in:
Ian Campbell 2017-11-09 11:23:45 +00:00
parent 425553d390
commit 22cdd22184

View File

@ -4,6 +4,13 @@ KUBE_NETWORK ?= weave-v2.0.5
INIT_YAML ?=
INIT_YAML += network.yaml
ifeq ($(shell uname -s),"Darwin")
KUBE_FORMATS ?= iso-efi
endif
KUBE_FORMATS ?= iso-bios
KUBE_FORMAT_ARGS := $(patsubst %,-format %,$(KUBE_FORMATS))
all: build-container-images build-vm-images
build-container-images:
@ -20,10 +27,10 @@ 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 -format iso-efi -format iso-bios kube.yml $(KUBE_RUNTIME).yml $(KUBE_RUNTIME)-master.yml
moby build -name kube-master $(KUBE_FORMAT_ARGS) kube.yml $(KUBE_RUNTIME).yml $(KUBE_RUNTIME)-master.yml
kube-node.iso: kube.yml $(KUBE_RUNTIME).yml
moby build -name kube-node -format iso-efi -format iso-bios $^
moby build -name kube-node $(KUBE_FORMAT_ARGS) $^
network.yaml: $(KUBE_NETWORK).yaml
ln -nf $< $@