From d4e93a76b5c86d8712fac2ac10fbb74dc46aa403 Mon Sep 17 00:00:00 2001 From: Marco Voelz Date: Fri, 16 Jun 2023 13:30:59 +0200 Subject: [PATCH] Explicitly create and remove buildx builders --- .../pkg/admission-controller/Makefile | 11 +++++++++-- vertical-pod-autoscaler/pkg/recommender/Makefile | 12 ++++++++++-- vertical-pod-autoscaler/pkg/updater/Makefile | 12 ++++++++++-- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/vertical-pod-autoscaler/pkg/admission-controller/Makefile b/vertical-pod-autoscaler/pkg/admission-controller/Makefile index 2f49dab74e4a..d1270fb4c5c3 100644 --- a/vertical-pod-autoscaler/pkg/admission-controller/Makefile +++ b/vertical-pod-autoscaler/pkg/admission-controller/Makefile @@ -42,7 +42,7 @@ ifndef TAG ERR = $(error TAG is undefined) $(ERR) endif - docker buildx build --pull --platform linux/$* -t ${REGISTRY}/${FULL_COMPONENT}-$*:${TAG} --build-arg ARCH=$* . + docker buildx build --pull --load --platform linux/$* -t ${REGISTRY}/${FULL_COMPONENT}-$*:${TAG} --build-arg ARCH=$* . .PHONY: docker-push docker-push: $(addprefix sub-push-,$(ALL_ARCHITECTURES)) push-multi-arch; @@ -78,9 +78,16 @@ build-in-docker: $(addprefix build-in-docker-,$(ALL_ARCHITECTURES)) build-in-docker-%: clean docker-builder docker run -v `pwd`/../..:/gopath/src/k8s.io/autoscaler/vertical-pod-autoscaler vpa-autoscaling-builder:latest bash -c 'cd /gopath/src/k8s.io/autoscaler/vertical-pod-autoscaler && make build-binary-with-vendor-$* -C pkg/admission-controller' +.PHONY: create-buildx-builder +create-buildx-builder: + BUILDER=$(shell docker buildx create --driver=docker-container --use) + +.PHONY: remove-buildx-builder +remove-buildx-builder: + docker buildx rm ${BUILDER} .PHONY: release -release: build-in-docker docker-build docker-push +release: build-in-docker create-buildx-builder docker-build remove-buildx-builder docker-push @echo "Full in-docker release ${FULL_COMPONENT}:${TAG} completed" clean: $(addprefix clean-,$(ALL_ARCHITECTURES)) diff --git a/vertical-pod-autoscaler/pkg/recommender/Makefile b/vertical-pod-autoscaler/pkg/recommender/Makefile index 9ee5e87e373b..5433d7c9bc1e 100644 --- a/vertical-pod-autoscaler/pkg/recommender/Makefile +++ b/vertical-pod-autoscaler/pkg/recommender/Makefile @@ -42,7 +42,7 @@ ifndef TAG ERR = $(error TAG is undefined) $(ERR) endif - docker buildx build --pull --platform linux/$* -t ${REGISTRY}/${FULL_COMPONENT}-$*:${TAG} --build-arg ARCH=$* . + docker buildx build --pull --load --platform linux/$* -t ${REGISTRY}/${FULL_COMPONENT}-$*:${TAG} --build-arg ARCH=$* . .PHONY: docker-push docker-push: $(addprefix sub-push-,$(ALL_ARCHITECTURES)) push-multi-arch; @@ -78,7 +78,15 @@ build-in-docker: $(addprefix build-in-docker-,$(ALL_ARCHITECTURES)) build-in-docker-%: clean docker-builder docker run -v `pwd`/../..:/gopath/src/k8s.io/autoscaler/vertical-pod-autoscaler vpa-autoscaling-builder:latest bash -c 'cd /gopath/src/k8s.io/autoscaler/vertical-pod-autoscaler && make build-binary-with-vendor-$* -C pkg/recommender' -release: build-in-docker docker-build docker-push +.PHONY: create-buildx-builder +create-buildx-builder: + BUILDER=$(shell docker buildx create --driver=docker-container --use) + +.PHONY: remove-buildx-builder +remove-buildx-builder: + docker buildx rm ${BUILDER} + +release: build-in-docker create-buildx-builder docker-build remove-buildx-builder docker-push @echo "Full in-docker release ${FULL_COMPONENT}:${TAG} completed" clean: $(addprefix clean-,$(ALL_ARCHITECTURES)) diff --git a/vertical-pod-autoscaler/pkg/updater/Makefile b/vertical-pod-autoscaler/pkg/updater/Makefile index bcc20d9e51c1..d2433aaa7deb 100644 --- a/vertical-pod-autoscaler/pkg/updater/Makefile +++ b/vertical-pod-autoscaler/pkg/updater/Makefile @@ -42,7 +42,7 @@ ifndef TAG ERR = $(error TAG is undefined) $(ERR) endif - docker buildx build --pull --platform linux/$* -t ${REGISTRY}/${FULL_COMPONENT}-$*:${TAG} --build-arg ARCH=$* . + docker buildx build --pull --load --platform linux/$* -t ${REGISTRY}/${FULL_COMPONENT}-$*:${TAG} --build-arg ARCH=$* . .PHONY: docker-push docker-push: $(addprefix sub-push-,$(ALL_ARCHITECTURES)) push-multi-arch; @@ -78,8 +78,16 @@ build-in-docker: $(addprefix build-in-docker-,$(ALL_ARCHITECTURES)) build-in-docker-%: clean docker-builder docker run -v `pwd`/../..:/gopath/src/k8s.io/autoscaler/vertical-pod-autoscaler vpa-autoscaling-builder:latest bash -c 'cd /gopath/src/k8s.io/autoscaler/vertical-pod-autoscaler && make build-binary-with-vendor-$* -C pkg/updater' +.PHONY: create-buildx-builder +create-buildx-builder: + BUILDER=$(shell docker buildx create --driver=docker-container --use) + +.PHONY: remove-buildx-builder +remove-buildx-builder: + docker buildx rm ${BUILDER} + .PHONY: release -release: build-in-docker docker-build docker-push +release: build-in-docker create-buildx-builder docker-build remove-buildx-builder docker-push @echo "Full in-docker release ${FULL_COMPONENT}:${TAG} completed" clean: $(addprefix clean-,$(ALL_ARCHITECTURES))