From 92f6480ed6b0550cfd50366b929ec49ad41eacaa Mon Sep 17 00:00:00 2001 From: Carl Henrik Lunde Date: Mon, 12 Sep 2022 22:26:02 +0200 Subject: [PATCH 1/2] Compile code-generator to avoid link overhead per service Signed-off-by: Carl Henrik Lunde --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index c95ca26ff4..93a9b4d614 100644 --- a/Makefile +++ b/Makefile @@ -140,11 +140,11 @@ services: $(GOIMPORTS) @if [ ! -d "$(WORK_DIR)/code-generator" ]; then \ cd $(WORK_DIR) && git clone "$(CODE_GENERATOR_REPO)"; \ fi - @cd $(WORK_DIR)/code-generator && git fetch origin && git checkout $(CODE_GENERATOR_COMMIT) + @cd $(WORK_DIR)/code-generator && git fetch origin && git checkout $(CODE_GENERATOR_COMMIT) && go build -tags codegen -o ack-generate cmd/ack-generate/main.go @for svc in $(SERVICES); do \ $(INFO) Generating $$svc controllers and CRDs; \ PATH="${PATH}:$(TOOLS_HOST_DIR)"; \ - cd $(WORK_DIR)/code-generator && go run -tags codegen cmd/ack-generate/main.go crossplane $$svc --output ../../ || exit 1; \ + cd $(WORK_DIR)/code-generator && ./ack-generate crossplane $$svc --output ../../ || exit 1; \ $(OK) Generating $$svc controllers and CRDs; \ done From 7859293223f8c681511d0459fbe1afc75eef2eaa Mon Sep 17 00:00:00 2001 From: Carl Henrik Lunde Date: Mon, 12 Sep 2022 22:26:26 +0200 Subject: [PATCH 2/2] Run AWS ACK code-generator with go.mod --aws-sdk-go-version This should allow us to bump the SDK version independently of upstream Thanks to @A-Hilaly for tips Fixes #1414 Fixes https://github.com/aws-controllers-k8s/community/issues/1441 Signed-off-by: Carl Henrik Lunde --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 93a9b4d614..6ecb6b8a40 100644 --- a/Makefile +++ b/Makefile @@ -134,6 +134,8 @@ run: go.build .PHONY: cobertura manifests submodules fallthrough test-integration run crds.clean +AWS_SDK_GO_VERSION ?= $(shell awk '/github.com\/aws\/aws-sdk-go / { print $$2 }' < go.mod) + # NOTE(muvaf): ACK Code Generator is a separate Go module, hence we need to # be in its root directory to call "go run" properly. services: $(GOIMPORTS) @@ -144,7 +146,7 @@ services: $(GOIMPORTS) @for svc in $(SERVICES); do \ $(INFO) Generating $$svc controllers and CRDs; \ PATH="${PATH}:$(TOOLS_HOST_DIR)"; \ - cd $(WORK_DIR)/code-generator && ./ack-generate crossplane $$svc --output ../../ || exit 1; \ + cd $(WORK_DIR)/code-generator && ./ack-generate crossplane --aws-sdk-go-version $(AWS_SDK_GO_VERSION) $$svc --output ../../ || exit 1; \ $(OK) Generating $$svc controllers and CRDs; \ done