Refactor into RenderAgent and ApplyAgent
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
include ../build.env
|
||||
-include ../build.env.work
|
||||
export
|
||||
|
||||
BUILD_PLATFORM ?= linux/amd64
|
||||
|
||||
@@ -11,21 +13,24 @@ KUBE_VERSION ?= v1.33.3
|
||||
|
||||
GIT_REV := $(shell git rev-parse HEAD)
|
||||
|
||||
PACKAGES_DIR := packages
|
||||
BIN_DIR := bin
|
||||
OUT_DIR := out
|
||||
PACKAGES_DIR := packages
|
||||
BIN_DIR := bin
|
||||
OUT_DIR := out
|
||||
UBOOT_TOOLS_OUT := $(OUT_DIR)/uboot-tools
|
||||
|
||||
UBOOT_TAR := $(PACKAGES_DIR)/uboot-$(UBOOT_VERSION).tar.gz
|
||||
BUILDINFO_FILE := pkg/buildinfo/buildinfo_gen.go
|
||||
CRD_PATHS := ./pkg/apis/...
|
||||
|
||||
ASSETS_PATH := ./pkg/assets
|
||||
|
||||
BUILDX_BUILDER := container-builder
|
||||
LOCAL_REGISTRY := registry
|
||||
LOCAL_REGISTRY_PORT := 5000
|
||||
|
||||
CTL_BUILD_BASE_IMAGE := localhost:5000/monok8s/ctl-build-base:$(VERSION)
|
||||
CTL_BINARY := ctl-linux-aarch64-$(VERSION)
|
||||
CTL_BUILD_BASE_REPO := localhost:5000/monok8s/ctl-build-base
|
||||
CTL_IMAGE_REPO := localhost:5000/monok8s/node-control
|
||||
|
||||
CTL_BUILD_BASE_IMAGE := $(CTL_BUILD_BASE_REPO):$(VERSION)
|
||||
CTL_IMAGE := $(CTL_IMAGE_REPO):$(VERSION)
|
||||
|
||||
DOWNLOAD_PACKAGES_STAMP := $(PACKAGES_DIR)/.download-packages.stamp
|
||||
|
||||
@@ -88,11 +93,14 @@ $(DOWNLOAD_PACKAGES_STAMP): docker/download-packages.Dockerfile makefile | $(PAC
|
||||
@touch $@
|
||||
|
||||
uboot-tools: $(DOWNLOAD_PACKAGES_STAMP)
|
||||
docker buildx build --platform linux/arm64 \
|
||||
rm -rf "$(UBOOT_TOOLS_OUT)"
|
||||
mkdir -p "$(UBOOT_TOOLS_OUT)"
|
||||
docker buildx build \
|
||||
--platform linux/amd64,linux/arm64 \
|
||||
-f docker/uboot-tools.Dockerfile \
|
||||
--build-arg UBOOT_VERSION=$(UBOOT_VERSION) \
|
||||
--build-arg UBOOT_TAR=$(UBOOT_TAR) \
|
||||
--output type=local,dest=./$(OUT_DIR) .
|
||||
--output type=local,dest=./$(UBOOT_TOOLS_OUT),platform-split=true .
|
||||
|
||||
ctl-build-base: ensure-buildx ensure-registry
|
||||
docker buildx build \
|
||||
@@ -101,16 +109,6 @@ ctl-build-base: ensure-buildx ensure-registry
|
||||
-t $(CTL_BUILD_BASE_IMAGE) \
|
||||
--output type=image,push=true,registry.insecure=true .
|
||||
|
||||
build-bin: .buildinfo ctl-build-base | $(BIN_DIR)
|
||||
docker buildx build \
|
||||
--platform $(BUILD_PLATFORM) \
|
||||
-f docker/ctl-builder.Dockerfile \
|
||||
--build-arg BASE_IMAGE=$(CTL_BUILD_BASE_IMAGE) \
|
||||
--build-arg VERSION=$(VERSION) \
|
||||
--build-arg TARGETOS=linux \
|
||||
--build-arg TARGETARCH=arm64 \
|
||||
--output type=local,dest=./$(BIN_DIR) .
|
||||
|
||||
build-crds: ctl-build-base | $(OUT_DIR)
|
||||
mkdir -p "$(OUT_DIR)/crds"
|
||||
docker buildx build \
|
||||
@@ -118,16 +116,20 @@ build-crds: ctl-build-base | $(OUT_DIR)
|
||||
-f docker/crdgen.Dockerfile \
|
||||
--build-arg BASE_IMAGE=$(CTL_BUILD_BASE_IMAGE) \
|
||||
--output type=local,dest=./$(OUT_DIR)/crds .
|
||||
rm -rf "$(ASSETS_PATH)/crds"
|
||||
mkdir -p "$(ASSETS_PATH)/crds"
|
||||
cp -R "$(OUT_DIR)/crds/." "$(ASSETS_PATH)/crds/"
|
||||
|
||||
build-agent: build uboot-tools
|
||||
build-agent: .buildinfo build-crds uboot-tools
|
||||
docker buildx build \
|
||||
--platform linux/arm64 \
|
||||
--platform linux/amd64,linux/arm64 \
|
||||
-f docker/ctl-agent.Dockerfile \
|
||||
--build-arg BASE_IMAGE=$(CTL_BUILD_BASE_IMAGE) \
|
||||
--build-arg VERSION=$(VERSION) \
|
||||
--load \
|
||||
-t localhost/monok8s/node-control:$(VERSION) .
|
||||
-t $(CTL_IMAGE) \
|
||||
--output type=image,push=true,registry.insecure=true .
|
||||
|
||||
build-local: .buildinfo | $(BIN_DIR)
|
||||
build-local: build-crds .buildinfo | $(BIN_DIR)
|
||||
docker buildx build \
|
||||
-f docker/ctl-builder-local.Dockerfile \
|
||||
--build-arg VERSION=$(VERSION) \
|
||||
@@ -135,14 +137,22 @@ build-local: .buildinfo | $(BIN_DIR)
|
||||
--build-arg GIT_REV=$(GIT_REV) \
|
||||
--output type=local,dest=./$(BIN_DIR) .
|
||||
|
||||
push-agent: .buildinfo build-crds uboot-tools
|
||||
test -n "$(IMAGE_REPOSITORY)"
|
||||
docker buildx build \
|
||||
--platform linux/amd64,linux/arm64 \
|
||||
-f docker/ctl-agent.Dockerfile \
|
||||
--build-arg BASE_IMAGE=$(CTL_BUILD_BASE_IMAGE) \
|
||||
--build-arg VERSION=$(VERSION) \
|
||||
-t $(IMAGE_REPOSITORY)/node-control:$(VERSION) \
|
||||
--push .
|
||||
|
||||
run-agent:
|
||||
docker run --rm \
|
||||
-v "$$(pwd)/out:/work/out" \
|
||||
localhost/monok8s/node-control:$(VERSION) \
|
||||
$(CTL_IMAGE) \
|
||||
agent --env-file /work/out/cluster.env
|
||||
|
||||
build: build-bin build-crds
|
||||
|
||||
clean:
|
||||
-docker image rm localhost/monok8s/node-control:$(VERSION) >/dev/null 2>&1 || true
|
||||
rm -rf \
|
||||
@@ -158,7 +168,6 @@ dockerclean:
|
||||
- docker rmi \
|
||||
localhost/monok8s/ctl-build-base:$(VERSION) \
|
||||
localhost/monok8s/node-control:$(VERSION) \
|
||||
localhost/monok8s/ctl-builder:$(VERSION) \
|
||||
localhost/monok8s/crdgen:$(VERSION) \
|
||||
2>/dev/null || true
|
||||
|
||||
@@ -169,10 +178,10 @@ dockerclean:
|
||||
pkgclean:
|
||||
rm -rf $(PACKAGES_DIR)
|
||||
|
||||
all: build build-agent build-local
|
||||
all: build-agent build-local
|
||||
|
||||
.PHONY: \
|
||||
all clean dockerclean \
|
||||
.buildinfo ensure-buildx ensure-registry \
|
||||
build build-bin build-crds build-local build-agent \
|
||||
uboot-tools run-agent
|
||||
build-crds build-local build-agent build-agent-local push-agent \
|
||||
uboot-tools run-agent run-agent-local
|
||||
|
||||
Reference in New Issue
Block a user