@@ -26,6 +26,18 @@ CNIFILES = \
2626 $(wildcard cni/network/plugin/* .go) \
2727 $(COREFILES )
2828
29+ CNSFILES = \
30+ $(wildcard cns/* .go) \
31+ $(wildcard cns/common/* .go) \
32+ $(wildcard cni/dockerclient/* .go) \
33+ $(wildcard cni/imdsclient/* .go) \
34+ $(wildcard cni/ipamclient/* .go) \
35+ $(wildcard cni/restserver/* .go) \
36+ $(wildcard cni/routes/* .go) \
37+ $(wildcard cni/service/* .go) \
38+ $(COREFILES ) \
39+ $(CNMFILES )
40+
2941# Build defaults.
3042GOOS ?= linux
3143GOARCH ?= amd64
@@ -34,10 +46,12 @@ GOARCH ?= amd64
3446CNM_DIR = cnm/plugin
3547CNI_NET_DIR = cni/network/plugin
3648CNI_IPAM_DIR = cni/ipam/plugin
49+ CNS_DIR = cns/service
3750OUTPUT_DIR = output
3851BUILD_DIR = $(OUTPUT_DIR ) /$(GOOS ) _$(GOARCH )
3952CNM_BUILD_DIR = $(BUILD_DIR ) /cnm
4053CNI_BUILD_DIR = $(BUILD_DIR ) /cni
54+ CNS_BUILD_DIR = $(BUILD_DIR ) /cns
4155
4256# Containerized build parameters.
4357BUILD_CONTAINER_IMAGE = acn-build
6074# Archive file names.
6175CNM_ARCHIVE_NAME = azure-vnet-cnm-$(GOOS ) -$(GOARCH ) -$(VERSION ) .$(ARCHIVE_EXT )
6276CNI_ARCHIVE_NAME = azure-vnet-cni-$(GOOS ) -$(GOARCH ) -$(VERSION ) .$(ARCHIVE_EXT )
77+ CNS_ARCHIVE_NAME = azure-cns-$(GOOS ) -$(GOARCH ) -$(VERSION ) .$(ARCHIVE_EXT )
6378
6479# Docker libnetwork (CNM) plugin v2 image parameters.
6580CNM_PLUGIN_IMAGE ?= microsoft/azure-vnet-plugin
@@ -74,7 +89,8 @@ azure-cnm-plugin: $(CNM_BUILD_DIR)/azure-vnet-plugin$(EXE_EXT) cnm-archive
7489azure-vnet : $(CNI_BUILD_DIR ) /azure-vnet$(EXE_EXT )
7590azure-vnet-ipam : $(CNI_BUILD_DIR ) /azure-vnet-ipam$(EXE_EXT )
7691azure-cni-plugin : azure-vnet azure-vnet-ipam cni-archive
77- all-binaries : azure-cnm-plugin azure-cni-plugin
92+ azure-cns : $(CNS_BUILD_DIR ) /azure-cns$(EXE_EXT ) cns-archive
93+ all-binaries : azure-cnm-plugin azure-cni-plugin azure-cns
7894
7995# Clean all build artifacts.
8096.PHONY : clean
@@ -93,6 +109,11 @@ $(CNI_BUILD_DIR)/azure-vnet$(EXE_EXT): $(CNIFILES)
93109$(CNI_BUILD_DIR ) /azure-vnet-ipam$(EXE_EXT ) : $(CNIFILES )
94110 go build -v -o $(CNI_BUILD_DIR ) /azure-vnet-ipam$(EXE_EXT ) -ldflags " -X main.version=$( VERSION) -s -w" $(CNI_IPAM_DIR ) /* .go
95111
112+ # Build the Azure CNS Service.
113+ $(CNS_BUILD_DIR ) /azure-cns$(EXE_EXT ) : $(CNSFILES )
114+ go build -v -o $(CNS_BUILD_DIR ) /azure-cns$(EXE_EXT ) -ldflags " -X main.version=$( VERSION) -s -w" $(CNS_DIR ) /* .go
115+
116+
96117# Build all binaries in a container.
97118.PHONY : all-binaries-containerized
98119all-binaries-containerized :
@@ -162,3 +183,10 @@ cnm-archive:
162183 chmod 0755 $(CNM_BUILD_DIR ) /azure-vnet-plugin$(EXE_EXT )
163184 cd $(CNM_BUILD_DIR ) && $(ARCHIVE_CMD ) $(CNM_ARCHIVE_NAME ) azure-vnet-plugin$(EXE_EXT )
164185 chown $(BUILD_USER ) :$(BUILD_USER ) $(CNM_BUILD_DIR ) /$(CNM_ARCHIVE_NAME )
186+
187+ # Create a CNS archive for the target platform.
188+ .PHONY : cns-archive
189+ cns-archive :
190+ chmod 0755 $(CNS_BUILD_DIR ) /azure-cns$(EXE_EXT )
191+ cd $(CNS_BUILD_DIR ) && $(ARCHIVE_CMD ) $(CNS_ARCHIVE_NAME ) azure-cns$(EXE_EXT )
192+ chown $(BUILD_USER ) :$(BUILD_USER ) $(CNS_BUILD_DIR ) /$(CNS_ARCHIVE_NAME )
0 commit comments