Skip to content

Commit

Permalink
Merge pull request crossplane-contrib#1840 from MisterMX/chore/ack-in…
Browse files Browse the repository at this point in the history
…tegration
  • Loading branch information
MisterMX authored Aug 11, 2023
2 parents 3f14add + 66c1021 commit bdf4b5f
Show file tree
Hide file tree
Showing 18 changed files with 1,198 additions and 15 deletions.
29 changes: 14 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ PROJECT_REPO := github.com/crossplane-contrib/$(PROJECT_NAME)

PLATFORMS ?= linux_amd64 linux_arm64

CODE_GENERATOR_REPO ?= https://github.com/aws-controllers-k8s/code-generator.git
CODE_GENERATOR_COMMIT ?= 29d348db5c9cb6e58843d9792b470fc6c7dd65f4
GENERATED_SERVICES ?= $(shell find ./apis -type f -name generator-config.yaml | cut -d/ -f 3 | tr '\n' ' ')

# kind-related versions
Expand Down Expand Up @@ -137,22 +135,23 @@ 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)
@if [ ! -d "$(WORK_DIR)" ]; then \
$(INFO) creating $(WORK_DIR) folder; \
mkdir $(WORK_DIR); \
fi
@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) && go build -tags codegen -o ack-generate cmd/ack-generate/main.go
ACK_VERSION ?= $(shell awk '/github.com\/aws-controllers-k8s\/code-generator / { print $$2 }' < go.mod)
ACK_GENERATE_DIR ?= $(CACHE_DIR)/ack-generate
ACK_GENERATE ?= $(ACK_GENERATE_DIR)/ack-generate_$(ACK_VERSION)

# Because ack-generate is executed many times during generate, we build a binary
# to speed up code generation compared to go run.
$(ACK_GENERATE):
@$(INFO) Building ack-generate $(ACK_VERSION)
@mkdir -p "$(ACK_GENERATE_DIR)"
@$(GO) build -o "$(ACK_GENERATE)" -tags codegen github.com/aws-controllers-k8s/code-generator/cmd/ack-generate || $(FAIL)
@$(OK) Built ack-generate $(ACK_VERSION)

services: $(ACK_GENERATE) $(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 --aws-sdk-go-version $(AWS_SDK_GO_VERSION) $$svc --output ../../ || exit 1; \
$(ACK_GENERATE) crossplane --aws-sdk-go-version $(AWS_SDK_GO_VERSION) $$svc --output=./ || exit 1; \
$(OK) Generating $$svc controllers and CRDs; \
done

Expand Down
2 changes: 2 additions & 0 deletions apis/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ limitations under the License.
package apis

import (
_ "github.com/aws-controllers-k8s/code-generator/cmd/ack-generate" //nolint:typecheck

_ "github.com/golang/mock/mockgen" //nolint:typecheck
_ "sigs.k8s.io/controller-tools/cmd/controller-gen" //nolint:typecheck

Expand Down
20 changes: 20 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/crossplane-contrib/provider-aws
go 1.19

require (
github.com/aws-controllers-k8s/code-generator v0.26.1
github.com/aws/aws-sdk-go v1.44.174
github.com/aws/aws-sdk-go-v2 v1.16.16
github.com/aws/aws-sdk-go-v2/config v1.11.1
Expand Down Expand Up @@ -54,6 +55,7 @@ require (
dario.cat/mergo v1.0.0 // indirect
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
github.com/aws-controllers-k8s/pkg v0.0.4 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.0.0 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.8.2 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.23 // indirect
Expand All @@ -64,14 +66,19 @@ require (
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.9.2 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.7.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/cenkalti/backoff/v3 v3.0.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/dave/jennifer v1.4.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dlclark/regexp2 v1.4.0 // indirect
github.com/emicklei/go-restful/v3 v3.10.2 // indirect
github.com/emirpasic/gods v1.12.0 // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/fatih/color v1.15.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gertd/go-pluralize v0.1.1 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-jose/go-jose/v3 v3.0.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/zapr v1.2.4 // indirect
Expand All @@ -95,11 +102,14 @@ require (
github.com/hashicorp/go-sockaddr v1.0.2 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/vault/api v1.9.2 // indirect
github.com/iancoleman/strcase v0.2.0 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
Expand All @@ -110,17 +120,24 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/operator-framework/api v0.6.0 // indirect
github.com/prometheus/client_golang v1.15.1 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.10.0 // indirect
github.com/ryanuber/go-glob v1.0.0 // indirect
github.com/samber/lo v1.37.0 // indirect
github.com/sergi/go-diff v1.0.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/afero v1.9.5 // indirect
github.com/spf13/cobra v1.7.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/src-d/gcfg v1.4.0 // indirect
github.com/xanzy/ssh-agent v0.2.1 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/oauth2 v0.8.0 // indirect
golang.org/x/sys v0.10.0 // indirect
Expand All @@ -134,6 +151,9 @@ require (
google.golang.org/grpc v1.56.2 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/src-d/go-billy.v4 v4.3.2 // indirect
gopkg.in/src-d/go-git.v4 v4.13.1 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.27.3 // indirect
Expand Down
Loading

0 comments on commit bdf4b5f

Please sign in to comment.