@@ -84,6 +84,10 @@ ACN_PACKAGE_PATH = github.com/Azure/azure-container-networking
8484CNI_AI_PATH =$(ACN_PACKAGE_PATH ) /telemetry.aiMetadata
8585CNS_AI_PATH =$(ACN_PACKAGE_PATH ) /cns/logger.aiMetadata
8686NPM_AI_PATH =$(ACN_PACKAGE_PATH ) /npm.aiMetadata
87+ CNI_TELEMETRY_SIDECAR_DIR = $(REPO_ROOT ) /cns/cni-telemetry-sidecar
88+ CNI_TELEMETRY_SIDECAR_BUILD_DIR = $(BUILD_DIR ) /cni-telemetry-sidecar
89+ CNI_TELEMETRY_SIDECAR_AI_ID = $(CNI_AI_ID ) # Reuse CNI AI ID
90+ CNI_TELEMETRY_SIDECAR_VERSION = $(CNS_VERSION ) # Version follows CNS
8791
8892# Tool paths
8993CONTROLLER_GEN := $(TOOLS_BIN_DIR ) /controller-gen
@@ -111,6 +115,7 @@ AZURE_IPAM_ARCHIVE_NAME = azure-ipam-$(GOOS)-$(GOARCH)-$(AZURE_IPAM_VERSION).$(A
111115AZURE_IP_MASQ_MERGER_ARCHIVE_NAME = azure-ip-masq-merger-$(GOOS ) -$(GOARCH ) -$(AZURE_IP_MASQ_MERGER_VERSION ) .$(ARCHIVE_EXT )
112116AZURE_IPTABLES_MONITOR_ARCHIVE_NAME = azure-iptables-monitor-$(GOOS ) -$(GOARCH ) -$(AZURE_IPTABLES_MONITOR_VERSION ) .$(ARCHIVE_EXT )
113117IPV6_HP_BPF_ARCHIVE_NAME = ipv6-hp-bpf-$(GOOS ) -$(GOARCH ) -$(IPV6_HP_BPF_VERSION ) .$(ARCHIVE_EXT )
118+ CNI_TELEMETRY_SIDECAR_ARCHIVE_NAME = azure-cni-telemetry-sidecar-$(GOOS ) -$(GOARCH ) -$(CNI_TELEMETRY_SIDECAR_VERSION ) .$(ARCHIVE_EXT )
114119
115120# Image info file names.
116121CNI_IMAGE_INFO_FILE = azure-cni-$(CNI_VERSION ) .txt
@@ -221,6 +226,10 @@ azure-vnet-ipamv6-binary:
221226azure-vnet-telemetry-binary :
222227 cd $(CNI_TELEMETRY_DIR ) && CGO_ENABLED=0 go build -v -o $(CNI_BUILD_DIR ) /azure-vnet-telemetry$(EXE_EXT ) -ldflags " -X main.version=$( CNI_VERSION) -X $( CNI_AI_PATH) =$( CNI_AI_ID) " -gcflags=" -dwarflocationlists=true"
223228
229+ # Build the Azure CNI Telemetry Sidecar binary.
230+ cni-telemetry-sidecar-binary :
231+ cd $(CNI_TELEMETRY_SIDECAR_DIR ) && CGO_ENABLED=0 go build -v -o $(CNI_TELEMETRY_SIDECAR_BUILD_DIR ) /azure-cni-telemetry-sidecar$(EXE_EXT ) -ldflags " -X main.version=$( CNI_TELEMETRY_SIDECAR_VERSION) -X $( CNI_AI_PATH) =$( CNI_TELEMETRY_SIDECAR_AI_ID) " -gcflags=" -dwarflocationlists=true"
232+
224233# Build the Azure CLI network binary.
225234acncli-binary :
226235 cd $(ACNCLI_DIR ) && CGO_ENABLED=0 go build -v -o $(ACNCLI_BUILD_DIR ) /acn$(EXE_EXT ) -ldflags " -X main.version=$( ACN_VERSION) " -gcflags=" -dwarflocationlists=true"
@@ -582,6 +591,35 @@ npm-image-pull: ## pull cns container image.
582591 IMAGE=$(NPM_IMAGE ) \
583592 TAG=$(NPM_PLATFORM_TAG )
584593
594+ # cni-telemetry-sidecar
595+
596+ cni-telemetry-sidecar-image-name : # util target to print the CNI telemetry sidecar image name
597+ @echo $(CNI_TELEMETRY_SIDECAR_IMAGE )
598+
599+ cni-telemetry-sidecar-image-name-and-tag : # util target to print the CNI telemetry sidecar image name and tag.
600+ @echo $(IMAGE_REGISTRY ) /$(CNI_TELEMETRY_SIDECAR_IMAGE ) :$(CNI_TELEMETRY_SIDECAR_PLATFORM_TAG )
601+
602+ cni-telemetry-sidecar-image : # # build cni-telemetry-sidecar container image.
603+ $(MAKE ) container \
604+ DOCKERFILE =cns/cni-telemetry-sidecar/Dockerfile \
605+ IMAGE=$(CNI_TELEMETRY_SIDECAR_IMAGE ) \
606+ EXTRA_BUILD_ARGS='--build-arg CNI_AI_PATH=$(CNI_AI_PATH ) --build-arg CNI_AI_ID=$(CNI_TELEMETRY_SIDECAR_AI_ID ) ' \
607+ PLATFORM=$(PLATFORM ) \
608+ TAG=$(CNI_TELEMETRY_SIDECAR_PLATFORM_TAG ) \
609+ TARGET=$(OS ) \
610+ OS=$(OS ) \
611+ ARCH=$(ARCH )
612+
613+ cni-telemetry-sidecar-image-push : # # push cni-telemetry-sidecar container image.
614+ $(MAKE ) container-push \
615+ IMAGE =$(CNI_TELEMETRY_SIDECAR_IMAGE ) \
616+ TAG=$(CNI_TELEMETRY_SIDECAR_PLATFORM_TAG )
617+
618+ cni-telemetry-sidecar-image-pull : # # pull cni-telemetry-sidecar container image.
619+ $(MAKE ) container-pull \
620+ IMAGE =$(CNI_TELEMETRY_SIDECAR_IMAGE ) \
621+ TAG=$(CNI_TELEMETRY_SIDECAR_PLATFORM_TAG )
622+
585623# # Reusable targets for building multiplat container image manifests.
586624
587625IMAGE_ARCHIVE_DIR ?= $(shell pwd)
@@ -737,6 +775,21 @@ npm-skopeo-archive: ## export tar archive of multiplat container manifest.
737775 IMAGE=$(NPM_IMAGE ) \
738776 TAG=$(NPM_VERSION )
739777
778+ cni-telemetry-sidecar-manifest-build : # # build cni-telemetry-sidecar multiplat container manifest.
779+ $(MAKE ) manifest-build \
780+ PLATFORMS ="$(PLATFORMS ) " \
781+ IMAGE=$(CNI_TELEMETRY_SIDECAR_IMAGE ) \
782+ TAG=$(CNI_TELEMETRY_SIDECAR_VERSION )
783+
784+ cni-telemetry-sidecar-manifest-push : # # push cni-telemetry-sidecar multiplat container manifest
785+ $(MAKE ) manifest-push \
786+ IMAGE =$(CNI_TELEMETRY_SIDECAR_IMAGE ) \
787+ TAG=$(CNI_TELEMETRY_SIDECAR_VERSION )
788+
789+ cni-telemetry-sidecar-skopeo-archive : # # export tar archive of cni-telemetry-sidecar multiplat container manifest.
790+ $(MAKE ) manifest-skopeo-archive \
791+ IMAGE =$(CNI_TELEMETRY_SIDECAR_IMAGE ) \
792+ TAG=$(CNI_TELEMETRY_SIDECAR_VERSION )
740793
741794# ########################## Archives ################################
742795
@@ -847,6 +900,14 @@ ifeq ($(GOOS),linux)
847900 cd $(IPV6_HP_BPF_BUILD_DIR) && $(ARCHIVE_CMD) $(IPV6_HP_BPF_ARCHIVE_NAME) ipv6-hp-bpf$(EXE_EXT)
848901endif
849902
903+ # Create a CNI Telemetry Sidecar archive for the target platform.
904+ .PHONY : cni-telemetry-sidecar-archive
905+ cni-telemetry-sidecar-archive : cni-telemetry-sidecar-binary
906+ ifeq ($(GOOS ) ,linux)
907+ $(MKDIR) $(CNI_TELEMETRY_SIDECAR_BUILD_DIR)
908+ cd $(CNI_TELEMETRY_SIDECAR_BUILD_DIR) && $(ARCHIVE_CMD) $(CNI_TELEMETRY_SIDECAR_ARCHIVE_NAME) azure-cni-telemetry-sidecar$(EXE_EXT)
909+ endif
910+
850911# #@ Utils
851912
852913clean : # # Clean build artifacts.
0 commit comments