@@ -30,18 +30,20 @@ EXE_EXT = .exe
3030endif
3131
3232# Interrogate the git repo and set some variables
33- REPO_ROOT ?= $(shell git rev-parse --show-toplevel)
34- REVISION ?= $(shell git rev-parse --short HEAD)
35- ACN_VERSION ?= $(shell git describe --exclude "azure-ipam* " --exclude "dropgz* " --exclude "zapai* " --exclude "ipv6-hp-bpf* " --tags --always)
36- IPV6_HP_BPF_VERSION ?= $(notdir $(shell git describe --match "ipv6-hp-bpf* " --tags --always) )
37- AZURE_IPAM_VERSION ?= $(notdir $(shell git describe --match "azure-ipam* " --tags --always) )
38- CNI_VERSION ?= $(ACN_VERSION )
39- CNS_VERSION ?= $(ACN_VERSION )
40- NPM_VERSION ?= $(ACN_VERSION )
41- ZAPAI_VERSION ?= $(notdir $(shell git describe --match "zapai* " --tags --always) )
33+ REPO_ROOT ?= $(shell git rev-parse --show-toplevel)
34+ REVISION ?= $(shell git rev-parse --short HEAD)
35+ ACN_VERSION ?= $(shell git describe --exclude "azure-ipam* " --exclude "dropgz* " --exclude "zapai* " --exclude "ipv6-hp-bpf* " --tags --always)
36+ IPV6_HP_BPF_VERSION ?= $(notdir $(shell git describe --match "ipv6-hp-bpf* " --tags --always) )
37+ AZURE_IPAM_VERSION ?= $(notdir $(shell git describe --match "azure-ipam* " --tags --always) )
38+ AZURE_IP_MASQ_MERGER_VERSION ?= $(notdir $(shell git describe --match "azure-ip-masq-merger* " --tags --always) )
39+ CNI_VERSION ?= $(ACN_VERSION )
40+ CNS_VERSION ?= $(ACN_VERSION )
41+ NPM_VERSION ?= $(ACN_VERSION )
42+ ZAPAI_VERSION ?= $(notdir $(shell git describe --match "zapai* " --tags --always) )
4243
4344# Build directories.
4445AZURE_IPAM_DIR = $(REPO_ROOT ) /azure-ipam
46+ AZURE_IP_MASQ_MERGER_DIR = $(REPO_ROOT ) /azure-ip-masq-merger
4547IPV6_HP_BPF_DIR = $(REPO_ROOT ) /bpf-prog/ipv6-hp-bpf
4648
4749CNI_NET_DIR = $(REPO_ROOT ) /cni/network/plugin
@@ -55,6 +57,7 @@ NPM_DIR = $(REPO_ROOT)/npm/cmd
5557OUTPUT_DIR = $(REPO_ROOT ) /output
5658BUILD_DIR = $(OUTPUT_DIR ) /$(GOOS ) _$(GOARCH )
5759AZURE_IPAM_BUILD_DIR = $(BUILD_DIR ) /azure-ipam
60+ AZURE_IP_MASQ_MERGER_BUILD_DIR = $(BUILD_DIR ) /azure-ip-masq-merger
5861IPV6_HP_BPF_BUILD_DIR = $(BUILD_DIR ) /bpf-prog/ipv6-hp-bpf
5962IMAGE_DIR = $(OUTPUT_DIR ) /images
6063
@@ -102,6 +105,7 @@ CNI_DUALSTACK_ARCHIVE_NAME = azure-vnet-cni-overlay-dualstack-$(GOOS)-$(GOARCH)-
102105CNS_ARCHIVE_NAME = azure-cns-$(GOOS ) -$(GOARCH ) -$(CNS_VERSION ) .$(ARCHIVE_EXT )
103106NPM_ARCHIVE_NAME = azure-npm-$(GOOS ) -$(GOARCH ) -$(NPM_VERSION ) .$(ARCHIVE_EXT )
104107AZURE_IPAM_ARCHIVE_NAME = azure-ipam-$(GOOS ) -$(GOARCH ) -$(AZURE_IPAM_VERSION ) .$(ARCHIVE_EXT )
108+ AZURE_IP_MASQ_MERGER_ARCHIVE_NAME = azure-ip-masq-merger-$(GOOS ) -$(GOARCH ) -$(AZURE_IP_MASQ_MERGER_VERSION ) .$(ARCHIVE_EXT )
105109IPV6_HP_BPF_ARCHIVE_NAME = ipv6-hp-bpf-$(GOOS ) -$(GOARCH ) -$(IPV6_HP_BPF_VERSION ) .$(ARCHIVE_EXT )
106110
107111# Image info file names.
@@ -119,8 +123,8 @@ all-binaries-platforms: ## Make all platform binaries
119123
120124# OS specific binaries/images
121125ifeq ($(GOOS ) ,linux)
122- all-binaries : acncli azure-cni-plugin azure-cns azure-npm azure-ipam ipv6-hp-bpf
123- all-images : npm-image cns-image cni-manager-image ipv6-hp-bpf-image
126+ all-binaries : acncli azure-cni-plugin azure-cns azure-npm azure-ipam azure-ip-masq-merger ipv6-hp-bpf
127+ all-images : npm-image cns-image cni-manager-image azure-ip-masq-merger-image ipv6-hp-bpf-image
124128else
125129all-binaries : azure-cni-plugin azure-cns azure-npm
126130all-images :
@@ -134,6 +138,7 @@ acncli: acncli-binary acncli-archive
134138azure-npm : azure-npm-binary npm-archive
135139azure-ipam : azure-ipam-binary azure-ipam-archive
136140ipv6-hp-bpf : ipv6-hp-bpf-binary ipv6-hp-bpf-archive
141+ azure-ip-masq-merger : azure-ip-masq-merger-binary azure-ip-masq-merger-archive
137142
138143
139144# #@ Versioning
@@ -149,6 +154,9 @@ acncli-version: version
149154azure-ipam-version : # # prints the azure-ipam version
150155 @echo $(AZURE_IPAM_VERSION )
151156
157+ azure-ip-masq-merger-version : # # prints the azure-ip-masq-merger version
158+ @echo $(AZURE_IP_MASQ_MERGER_VERSION )
159+
152160ipv6-hp-bpf-version : # # prints the ipv6-hp-bpf version
153161 @echo $(IPV6_HP_BPF_VERSION )
154162
@@ -218,6 +226,10 @@ azure-npm-binary:
218226 cd $(CNI_TELEMETRY_DIR ) && CGO_ENABLED=0 go build -v -o $(NPM_BUILD_DIR ) /azure-vnet-telemetry$(EXE_EXT ) -ldflags " -X main.version=$( NPM_VERSION) " -gcflags=" -dwarflocationlists=true"
219227 cd $(NPM_DIR ) && CGO_ENABLED=0 go build -v -o $(NPM_BUILD_DIR ) /azure-npm$(EXE_EXT ) -ldflags " -X main.version=$( NPM_VERSION) -X $( NPM_AI_PATH) =$( NPM_AI_ID) " -gcflags=" -dwarflocationlists=true"
220228
229+ # Build the azure-ip-masq-merger binary.
230+ azure-ip-masq-merger-binary :
231+ cd $(AZURE_IP_MASQ_MERGER_DIR ) && CGO_ENABLED=0 go build -v -o $(AZURE_IP_MASQ_MERGER_BUILD_DIR ) /azure-ip-masq-merger$(EXE_EXT ) -ldflags " -X main.version=$( AZURE_IP_MASQ_MERGER_VERSION) " -gcflags=" -dwarflocationlists=true"
232+
221233# #@ Containers
222234
223235# # Common variables for all containers.
@@ -256,12 +268,13 @@ CONTAINER_TRANSPORT = docker
256268endif
257269
258270# # Image name definitions.
259- ACNCLI_IMAGE = acncli
260- AZURE_IPAM_IMAGE = azure-ipam
261- IPV6_HP_BPF_IMAGE = ipv6-hp-bpf
262- CNI_IMAGE = azure-cni
263- CNS_IMAGE = azure-cns
264- NPM_IMAGE = azure-npm
271+ ACNCLI_IMAGE = acncli
272+ AZURE_IPAM_IMAGE = azure-ipam
273+ IPV6_HP_BPF_IMAGE = ipv6-hp-bpf
274+ CNI_IMAGE = azure-cni
275+ CNS_IMAGE = azure-cns
276+ NPM_IMAGE = azure-npm
277+ AZURE_IP_MASQ_MERGER_IMAGE = azure-ip-masq-merger
265278
266279# # Image platform tags.
267280ACNCLI_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM ) ) -$(ACN_VERSION )
@@ -273,6 +286,7 @@ CNI_WINDOWS_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))-$(CNI_VERSION)-$(OS_SKU_WI
273286CNS_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM ) ) -$(CNS_VERSION )
274287CNS_WINDOWS_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM ) ) -$(CNS_VERSION ) -$(OS_SKU_WIN )
275288NPM_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM ) ) -$(NPM_VERSION )
289+ AZURE_IP_MASQ_MERGER_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM ) ) -$(AZURE_IP_MASQ_MERGER_VERSION )
276290
277291
278292qemu-user-static : # # Set up the host to run qemu multiplatform container builds.
@@ -383,6 +397,34 @@ azure-ipam-image-pull: ## pull azure-ipam container image.
383397 IMAGE=$(AZURE_IPAM_IMAGE ) \
384398 TAG=$(AZURE_IPAM_PLATFORM_TAG )
385399
400+ # azure-ip-masq-merger
401+ azure-ip-masq-merger-image-name : # util target to print the azure-ip-masq-merger image name.
402+ @echo $(AZURE_IP_MASQ_MERGER_IMAGE )
403+
404+ azure-ip-masq-merger-image-name-and-tag : # util target to print the azure-ip-masq-merger image name and tag.
405+ @echo $(IMAGE_REGISTRY ) /$(AZURE_IP_MASQ_MERGER_IMAGE ) :$(AZURE_IP_MASQ_MERGER_PLATFORM_TAG )
406+
407+ azure-ip-masq-merger-image : # # build azure-ip-masq-merger container image.
408+ $(MAKE ) container \
409+ DOCKERFILE=azure-ip-masq-merger/Dockerfile \
410+ IMAGE=$(AZURE_IP_MASQ_MERGER_IMAGE ) \
411+ PLATFORM=$(PLATFORM ) \
412+ TAG=$(AZURE_IP_MASQ_MERGER_PLATFORM_TAG ) \
413+ TARGET=$(OS ) \
414+ OS=$(OS ) \
415+ ARCH=$(ARCH )
416+
417+ azure-ip-masq-merger-image-push : # # push azure-ip-masq-merger container image.
418+ $(MAKE ) container-push \
419+ IMAGE=$(AZURE_IP_MASQ_MERGER_IMAGE ) \
420+ TAG=$(AZURE_IP_MASQ_MERGER_PLATFORM_TAG )
421+
422+ azure-ip-masq-merger-image-pull : # # pull azure-ip-masq-merger container image.
423+ $(MAKE ) container-pull \
424+ IMAGE=$(AZURE_IP_MASQ_MERGER_IMAGE ) \
425+ TAG=$(AZURE_IP_MASQ_MERGER_PLATFORM_TAG )
426+
427+
386428# ipv6-hp-bpf
387429
388430ipv6-hp-bpf-image-name : # util target to print the ipv6-hp-bpf image name.
@@ -559,6 +601,22 @@ azure-ipam-skopeo-archive: ## export tar archive of azure-ipam multiplat contain
559601 IMAGE=$(AZURE_IPAM_IMAGE ) \
560602 TAG=$(AZURE_IPAM_VERSION )
561603
604+ azure-ip-masq-merger-manifest-build : # # build azure-ip-masq-merger multiplat container manifest.
605+ $(MAKE ) manifest-build \
606+ PLATFORMS=" $( PLATFORMS) " \
607+ IMAGE=$(AZURE_IP_MASQ_MERGER_IMAGE ) \
608+ TAG=$(AZURE_IP_MASQ_MERGER_VERSION )
609+
610+ azure-ip-masq-merger-manifest-push : # # push azure-ip-masq-merger multiplat container manifest
611+ $(MAKE ) manifest-push \
612+ IMAGE=$(AZURE_IP_MASQ_MERGER_IMAGE ) \
613+ TAG=$(AZURE_IP_MASQ_MERGER_VERSION )
614+
615+ azure-ip-masq-merger-skopeo-archive : # # export tar archive of azure-ip-masq-merger multiplat container manifest.
616+ $(MAKE ) manifest-skopeo-archive \
617+ IMAGE=$(AZURE_IP_MASQ_MERGER_IMAGE ) \
618+ TAG=$(AZURE_IP_MASQ_MERGER_VERSION )
619+
562620ipv6-hp-bpf-manifest-build : # # build ipv6-hp-bpf multiplat container manifest.
563621 $(MAKE ) manifest-build \
564622 PLATFORMS=" $( PLATFORMS) " \
@@ -709,6 +767,14 @@ ifeq ($(GOOS),linux)
709767 cd $(AZURE_IPAM_BUILD_DIR) && $(ARCHIVE_CMD) $(AZURE_IPAM_ARCHIVE_NAME) azure-ipam$(EXE_EXT)
710768endif
711769
770+ # Create a azure-ip-masq-merger archive for the target platform.
771+ .PHONY : azure-ip-masq-merger-archive
772+ azure-ip-masq-merger-archive : azure-ip-masq-merger-binary
773+ ifeq ($(GOOS ) ,linux)
774+ $(MKDIR) $(AZURE_IP_MASQ_MERGER_BUILD_DIR)
775+ cd $(AZURE_IP_MASQ_MERGER_BUILD_DIR) && $(ARCHIVE_CMD) $(AZURE_IP_MASQ_MERGER_ARCHIVE_NAME) azure-ip-masq-merger$(EXE_EXT)
776+ endif
777+
712778# Create a ipv6-hp-bpf archive for the target platform.
713779.PHONY : ipv6-hp-bpf-archive
714780ipv6-hp-bpf-archive : ipv6-hp-bpf-binary
@@ -791,6 +857,9 @@ test-extended-cyclonus: ## run the cyclonus test for npm.
791857test-azure-ipam : # # run the unit test for azure-ipam
792858 cd $(AZURE_IPAM_DIR ) && go test
793859
860+ test-azure-ip-masq-merger : # # run the unit test for azure-ip-masq-merger
861+ cd $(AZURE_IP_MASQ_MERGER_DIR ) && go test
862+
794863kind :
795864 kind create cluster --config ./test/kind/kind.yaml
796865
0 commit comments