@@ -8,13 +8,16 @@ AUTO_INSTRUMENTATION_PYTHON_VERSION ?= "$(shell grep -v '\#' versions.txt | grep
88AUTO_INSTRUMENTATION_DOTNET_VERSION ?= "$(shell grep -v '\#' versions.txt | grep aws-otel-dotnet-instrumentation | awk -F= '{print $$2}') "
99DCGM_EXPORTER_VERSION ?= "$(shell grep -v '\#' versions.txt | grep dcgm-exporter | awk -F= '{print $$2}') "
1010NEURON_MONITOR_VERSION ?= "$(shell grep -v '\#' versions.txt | grep neuron-monitor | awk -F= '{print $$2}') "
11-
11+ TARGET_ALLOCATOR_VERSION ?= $( shell grep -v '\#' versions.txt | grep target-allocator | awk -F= '{print $$2}')
1212# Image URL to use all building/pushing image targets
1313IMG_PREFIX ?= aws
1414IMG_REPO ?= cloudwatch-agent-operator
1515IMG ?= ${IMG_PREFIX}/${IMG_REPO}:${VERSION}
1616ARCH ?= $(shell go env GOARCH)
1717
18+ TARGET_ALLOCATOR_IMG_REPO ?= target-allocator
19+ TARGET_ALLOCATOR_IMG ?= ${IMG_PREFIX}/${TARGET_ALLOCATOR_IMG_REPO}:${TARGET_ALLOCATOR_VERSION}
20+
1821# Options for 'bundle-build'
1922ifneq ($(origin CHANNELS ) , undefined)
2023BUNDLE_CHANNELS := --channels=$(CHANNELS )
@@ -95,6 +98,10 @@ test: generate fmt vet envtest
9598.PHONY : manager
9699manager : generate fmt vet
97100 go build -o bin/manager main.go
101+ # Build target allocator binary
102+ .PHONY : targetallocator
103+ targetallocator :
104+ cd cmd/amazon-cloudwatch-agent-target-allocator && CGO_ENABLED=0 GOOS=$(GOOS ) GOARCH=$(ARCH ) go build -installsuffix cgo -o bin/targetallocator_${ARCH} -ldflags " ${LDFLAGS} " .
98105
99106# Run against the configured Kubernetes cluster in ~/.kube/config
100107.PHONY : run
@@ -161,6 +168,19 @@ container:
161168container-push :
162169 docker push ${IMG}
163170
171+ .PHONY : container-target-allocator-push
172+ container-target-allocator-push :
173+ docker push ${TARGET_ALLOCATOR_IMG}
174+
175+ .PHONY : container-target-allocator
176+ container-target-allocator : GOOS = linux
177+ container-target-allocator : targetallocator
178+ docker buildx build --load --platform linux/${ARCH} -t ${TARGET_ALLOCATOR_IMG} cmd/amazon-cloudwatch-agent-target-allocator
179+
180+ .PHONY : ta-build-and-push
181+ ta-build-and-push : container-target-allocator
182+ ta-build-and-push : container-target-allocator-push
183+
164184.PHONY : kustomize
165185kustomize : # # Download kustomize locally if necessary.
166186 $(call go-get-tool,$(KUSTOMIZE ) ,sigs.k8s.io/kustomize/kustomize/v5,$(KUSTOMIZE_VERSION ) )
0 commit comments