@@ -34,9 +34,7 @@ CNI_IPAM_DIR = $(REPO_ROOT)/cni/ipam/plugin
3434CNI_IPAMV6_DIR = $(REPO_ROOT ) /cni/ipam/pluginv6
3535CNI_TELEMETRY_DIR = $(REPO_ROOT ) /cni/telemetry/service
3636ACNCLI_DIR = $(REPO_ROOT ) /tools/acncli
37- TELEMETRY_CONF_DIR = $(REPO_ROOT ) /telemetry
3837CNS_DIR = $(REPO_ROOT ) /cns/service
39- CNMS_DIR = $(REPO_ROOT ) /cnms/service
4038NPM_DIR = $(REPO_ROOT ) /npm/cmd
4139OUTPUT_DIR = $(REPO_ROOT ) /output
4240BUILD_DIR = $(OUTPUT_DIR ) /$(GOOS ) _$(GOARCH )
@@ -48,15 +46,16 @@ CNI_MULTITENANCY_BUILD_DIR = $(BUILD_DIR)/cni-multitenancy
4846CNI_SWIFT_BUILD_DIR = $(BUILD_DIR ) /cni-swift
4947CNI_BAREMETAL_BUILD_DIR = $(BUILD_DIR ) /cni-baremetal
5048CNS_BUILD_DIR = $(BUILD_DIR ) /cns
51- CNMS_BUILD_DIR = $(BUILD_DIR ) /cnms
5249NPM_BUILD_DIR = $(BUILD_DIR ) /npm
53- NPM_RELATIVE_BUILD_DIR = output/$(GOOS ) _$(GOARCH ) /npm
54- NPM_TELEMETRY_DIR = $(NPM_BUILD_DIR ) /telemetry
5550TOOLS_DIR = $(REPO_ROOT ) /build/tools
5651TOOLS_BIN_DIR = $(TOOLS_DIR ) /bin
5752CNI_AI_ID = 5515a1eb-b2bc-406a-98eb-ba462e6f0411
53+ CNS_AI_ID = ce672799-8f08-4235-8c12-08563dc2acef
5854NPM_AI_ID = 014c22bd-4107-459e-8475-67909e96edcb
5955ACN_PACKAGE_PATH = github.com/Azure/azure-container-networking
56+ CNI_AI_PATH =$(ACN_PACKAGE_PATH ) /telemetry.aiMetadata
57+ CNS_AI_PATH =$(ACN_PACKAGE_PATH ) /cns/logger.aiMetadata
58+ NPM_AI_PATH =$(ACN_PACKAGE_PATH ) /npm.aiMetadata
6059
6160# Tool paths
6261CONTROLLER_GEN := $(TOOLS_BIN_DIR ) /controller-gen
@@ -75,13 +74,10 @@ CNI_MULTITENANCY_ARCHIVE_NAME = azure-vnet-cni-multitenancy-$(GOOS)-$(GOARCH)-$(
7574CNI_SWIFT_ARCHIVE_NAME = azure-vnet-cni-swift-$(GOOS ) -$(GOARCH ) -$(VERSION ) .$(ARCHIVE_EXT )
7675CNI_BAREMETAL_ARCHIVE_NAME = azure-vnet-cni-baremetal-$(GOOS ) -$(GOARCH ) -$(VERSION ) .$(ARCHIVE_EXT )
7776CNS_ARCHIVE_NAME = azure-cns-$(GOOS ) -$(GOARCH ) -$(VERSION ) .$(ARCHIVE_EXT )
78- CNMS_ARCHIVE_NAME = azure-cnms-$(GOOS ) -$(GOARCH ) -$(VERSION ) .$(ARCHIVE_EXT )
7977NPM_ARCHIVE_NAME = azure-npm-$(GOOS ) -$(GOARCH ) -$(VERSION ) .$(ARCHIVE_EXT )
80- NPM_IMAGE_ARCHIVE_NAME = azure-npm-$(GOOS ) - $( GOARCH ) - $( VERSION ) .$( ARCHIVE_EXT )
78+ NPM_IMAGE_INFO_FILE = azure-npm-$(VERSION ) .txt
8179CNI_IMAGE_ARCHIVE_NAME = azure-cni-manager-$(GOOS ) -$(GOARCH ) -$(VERSION ) .$(ARCHIVE_EXT )
82- CNMS_IMAGE_ARCHIVE_NAME = azure-cnms-$(GOOS ) -$(GOARCH ) -$(VERSION ) .$(ARCHIVE_EXT )
83- TELEMETRY_IMAGE_ARCHIVE_NAME = azure-vnet-telemetry-$(GOOS ) -$(GOARCH ) -$(VERSION ) .$(ARCHIVE_EXT )
84- CNS_IMAGE_ARCHIVE_NAME = azure-cns-$(GOOS ) -$(GOARCH ) -$(VERSION ) .$(ARCHIVE_EXT )
80+ CNS_IMAGE_INFO_FILE = azure-cns-$(VERSION ) .txt
8581
8682# Docker libnetwork (CNM) plugin v2 image parameters.
8783CNM_PLUGIN_IMAGE ?= microsoft/azure-vnet-plugin
@@ -92,21 +88,16 @@ IMAGE_REGISTRY ?= acnpublic.azurecr.io
9288# Azure network policy manager parameters.
9389AZURE_NPM_IMAGE ?= $(IMAGE_REGISTRY ) /azure-npm
9490
95- # Azure cnms parameters
96- AZURE_CNMS_IMAGE ?= $(IMAGE_REGISTRY ) /networkmonitor
97-
9891# Azure CNI installer parameters
9992AZURE_CNI_IMAGE = $(IMAGE_REGISTRY ) /azure-cni-manager
10093
101- # Azure vnet telemetry image parameters.
102- AZURE_VNET_TELEMETRY_IMAGE = $(IMAGE_REGISTRY ) /azure-vnet-telemetry
103-
10494# Azure container networking service image paramters.
10595AZURE_CNS_IMAGE = $(IMAGE_REGISTRY ) /azure-cns
10696
97+ IMAGE_PLATFORM_ARCHES ?= linux/amd64,linux/arm64
98+ IMAGE_ACTION ?= push
99+
107100VERSION ?= $(shell git describe --tags --always --dirty)
108- CNS_AI_ID = ce672799-8f08-4235-8c12-08563dc2acef
109- cnsaipath =github.com/Azure/azure-container-networking/cns/logger.aiMetadata
110101
111102# Default target
112103.PHONY : all-binaries-platforms
@@ -119,7 +110,7 @@ all-binaries-platforms: ## Make all platform binaries
119110
120111# OS specific binaries/images
121112ifeq ($(GOOS ) ,linux)
122- all-binaries : azure-cnm-plugin azure-cni-plugin azure-cns azure-cnms azure- npm
113+ all-binaries : azure-cnm-plugin azure-cni-plugin azure-cns azure-npm
123114all-images : azure-npm-image azure-cns-image
124115else
125116all-binaries : azure-cnm-plugin azure-cni-plugin azure-cns
@@ -166,7 +157,7 @@ azure-vnet-ipamv6-binary:
166157# Build the Azure CNI telemetry binary.
167158.PHONY : azure-vnet-telemetry-binary
168159azure-vnet-telemetry-binary :
169- cd $(CNI_TELEMETRY_DIR ) && CGO_ENABLED=0 go build -v -o $(CNI_BUILD_DIR ) /azure-vnet-telemetry$(EXE_EXT ) -ldflags " -X main.version=$( VERSION) -X $( ACN_PACKAGE_PATH ) /telemetry.aiMetadata =$( CNI_AI_ID) " -gcflags=" -dwarflocationlists=true"
160+ cd $(CNI_TELEMETRY_DIR ) && CGO_ENABLED=0 go build -v -o $(CNI_BUILD_DIR ) /azure-vnet-telemetry$(EXE_EXT ) -ldflags " -X main.version=$( VERSION) -X $( CNI_AI_PATH ) =$( CNI_AI_ID) " -gcflags=" -dwarflocationlists=true"
170161
171162# Build the Azure CLI network binary.
172163.PHONY : acncli-binary
@@ -176,18 +167,13 @@ acncli-binary:
176167# Build the Azure CNS binary.
177168.PHONY : azure-cns-binary
178169azure-cns-binary :
179- cd $(CNS_DIR ) && CGO_ENABLED=0 go build -v -o $(CNS_BUILD_DIR ) /azure-cns$(EXE_EXT ) -ldflags " -X main.version=$( VERSION) -X $( cnsaipath) =$( CNS_AI_ID) " -gcflags=" -dwarflocationlists=true"
180-
181- # Build the Azure CNMS binary.
182- .PHONY : azure-cnms-binary
183- azure-cnms-binary :
184- cd $(CNMS_DIR ) && CGO_ENABLED=0 go build -v -o $(CNMS_BUILD_DIR ) /azure-cnms$(EXE_EXT ) -ldflags " -X main.version=$( VERSION) " -gcflags=" -dwarflocationlists=true"
170+ cd $(CNS_DIR ) && CGO_ENABLED=0 go build -v -o $(CNS_BUILD_DIR ) /azure-cns$(EXE_EXT ) -ldflags " -X main.version=$( VERSION) -X $( CNS_AI_PATH) =$( CNS_AI_ID) " -gcflags=" -dwarflocationlists=true"
185171
186172# Build the Azure NPM binary.
187173.PHONY : azure-npm-binary
188174azure-npm-binary :
189175 cd $(CNI_TELEMETRY_DIR ) && CGO_ENABLED=0 go build -v -o $(NPM_BUILD_DIR ) /azure-vnet-telemetry$(EXE_EXT ) -ldflags " -X main.version=$( VERSION) " -gcflags=" -dwarflocationlists=true"
190- cd $(NPM_DIR ) && CGO_ENABLED=0 go build -v -o $(NPM_BUILD_DIR ) /azure-npm$(EXE_EXT ) -ldflags " -X main.version=$( VERSION) -X $( ACN_PACKAGE_PATH ) /npm.aiMetadata =$( NPM_AI_ID) " -gcflags=" -dwarflocationlists=true"
176+ cd $(NPM_DIR ) && CGO_ENABLED=0 go build -v -o $(NPM_BUILD_DIR ) /azure-npm$(EXE_EXT ) -ldflags " -X main.version=$( VERSION) -X $( NPM_AI_PATH ) =$( NPM_AI_ID) " -gcflags=" -dwarflocationlists=true"
191177
192178
193179# ########################## Container Images ########################
@@ -233,58 +219,42 @@ azure-cnm-plugin-image: azure-cnm-plugin
233219
234220# Build the Azure NPM image.
235221.PHONY : azure-npm-image
236- azure-npm-image : azure-npm-binary
222+ azure-npm-image :
237223ifeq ($(GOOS ) ,linux)
238224 $(MKDIR) $(IMAGE_DIR)
239- docker build \
225+ docker buildx create --use
226+ docker buildx build \
240227 --no-cache \
241228 -f npm/Dockerfile \
242229 -t $(AZURE_NPM_IMAGE):$(VERSION) \
243- --build-arg NPM_BUILD_DIR=$(NPM_RELATIVE_BUILD_DIR) \
244- .
245- docker save $(AZURE_NPM_IMAGE):$(VERSION) | gzip -c > $(IMAGE_DIR)/$(NPM_IMAGE_ARCHIVE_NAME)
246- endif
247-
248- # Build the Azure CNMS image
249- .PHONY : azure-cnms-image
250- azure-cnms-image : azure-cnms-binary
251- ifeq ($(GOOS ) ,linux)
252- $(MKDIR) $(IMAGE_DIR)
253- docker build \
254- --no-cache \
255- -f cnms/Dockerfile \
256- -t $(AZURE_CNMS_IMAGE):$(VERSION) \
257- --build-arg CNMS_BUILD_DIR=$(CNMS_BUILD_DIR) \
230+ --build-arg VERSION=$(VERSION) \
231+ --build-arg NPM_AI_PATH=$(NPM_AI_PATH) \
232+ --build-arg NPM_AI_ID=$(NPM_AI_ID) \
233+ --platform=$(IMAGE_PLATFORM_ARCHES) \
234+ --$(IMAGE_ACTION) \
258235 .
259- docker save $(AZURE_CNMS_IMAGE):$(VERSION) | gzip -c > $(IMAGE_DIR)/$(CNMS_IMAGE_ARCHIVE_NAME)
236+
237+ echo $(AZURE_NPM_IMAGE):$(VERSION) > $(IMAGE_DIR)/$(NPM_IMAGE_INFO_FILE)
260238endif
261239
262- # Build the Azure vnet telemetry image
263- .PHONY : azure-vnet-telemetry-image
264- azure-vnet-telemetry-image : azure-vnet-telemetry-binary
265- $(MKDIR ) $(IMAGE_DIR )
266- docker build \
267- -f cni/telemetry/Dockerfile \
268- -t $(AZURE_VNET_TELEMETRY_IMAGE ) :$(VERSION ) \
269- --build-arg TELEMETRY_BUILD_DIR=$(NPM_BUILD_DIR ) \
270- --build-arg TELEMETRY_CONF_DIR=$(TELEMETRY_CONF_DIR ) \
271- .
272- docker save $(AZURE_VNET_TELEMETRY_IMAGE ) :$(VERSION ) | gzip -c > $(NPM_BUILD_DIR ) /$(TELEMETRY_IMAGE_ARCHIVE_NAME )
273-
274240# Build the Azure CNS image
275241.PHONY : azure-cns-image
276242azure-cns-image :
277243ifeq ($(GOOS ) ,linux)
278244 $(MKDIR) $(IMAGE_DIR)
279- docker build \
245+ docker buildx create --use
246+ docker buildx build \
280247 --no-cache \
281248 -f cns/Dockerfile \
282249 -t $(AZURE_CNS_IMAGE):$(VERSION) \
283250 --build-arg VERSION=$(VERSION) \
284- --build-arg CNS_AI_PATH=$(cnsaipath ) \
251+ --build-arg CNS_AI_PATH=$(CNS_AI_PATH ) \
285252 --build-arg CNS_AI_ID=$(CNS_AI_ID) \
253+ --platform=$(IMAGE_PLATFORM_ARCHES) \
254+ --$(IMAGE_ACTION) \
286255 .
287- docker save $(AZURE_CNS_IMAGE):$(VERSION) | gzip -c > $(IMAGE_DIR)/$(CNS_IMAGE_ARCHIVE_NAME)
256+
257+ echo $(AZURE_CNS_IMAGE):$(VERSION) > $(IMAGE_DIR)/$(CNS_IMAGE_INFO_FILE)
288258endif
289259
290260# ########################## Archives ################################
@@ -339,13 +309,6 @@ cns-archive: azure-cns-binary
339309 cp cns/configuration/cns_config.json $(CNS_BUILD_DIR ) /cns_config.json
340310 cd $(CNS_BUILD_DIR ) && $(ARCHIVE_CMD ) $(CNS_ARCHIVE_NAME ) azure-cns$(EXE_EXT ) cns_config.json
341311
342- # Create a CNMS archive for the target platform. Only Linux is supported for now.
343- .PHONY : cnms-archive
344- cnms-archive : azure-cnms-binary
345- ifeq ($(GOOS ) ,linux)
346- cd $(CNMS_BUILD_DIR) && $(ARCHIVE_CMD) $(CNMS_ARCHIVE_NAME) azure-cnms$(EXE_EXT)
347- endif
348-
349312# Create a NPM archive for the target platform. Only Linux is supported for now.
350313.PHONY : npm-archive
351314npm-archive : azure-npm-binary
@@ -364,21 +327,6 @@ release:
364327publish-azure-cnm-plugin-image :
365328 docker plugin push $(CNM_PLUGIN_IMAGE ) :$(VERSION )
366329
367- # Publish the Azure vnet telemetry image to a Docker registry
368- .PHONY : publish-azure-vnet-telemetry-image
369- publish-azure-vnet-telemetry-image :
370- docker push $(AZURE_VNET_TELEMETRY_IMAGE ) :$(VERSION )
371-
372- # Publish the Azure NPM image to a Docker registry
373- .PHONY : publish-azure-npm-image
374- publish-azure-npm-image :
375- docker push $(AZURE_NPM_IMAGE ) :$(VERSION )
376-
377- # Publish the Azure CNS image to a Docker registry
378- .PHONY : publish-azure-cns-image
379- publish-azure-cns-image :
380- docker push $(AZURE_CNS_IMAGE ) :$(VERSION )
381-
382330# ########################### Linting ################################
383331
384332PRETTYGOTEST := $(shell command -v gotest 2> /dev/null)
0 commit comments