Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We need to ensure that all ACK developers are using the same controller-gen version otherwise we get into situations where: 1) go.mod/go.sum change unnecessarily 2) The annotations for things like CRDs will be different for generated YAML manifests This patch makes v0.4.0 of the controller-tools repo and controller-gen binary our target version. It changes the `ensure_controller_gen` Bash function to ensure that controller-gen at that version is installed and refuses to proceed with building controllers if there is a different version. ``` jaypipes@thelio:~/go/src/github.com/aws/aws-controllers-k8s$ controller-gen --version Version: v0.3.1-0.20200716001835-4a903ddb7005 jaypipes@thelio:~/go/src/github.com/aws/aws-controllers-k8s$ make build-controller SERVICE=dynamodb make[1]: Entering directory '/home/jaypipes/go/src/github.com/aws/aws-controllers-k8s' go build -tags codegen -ldflags "-X main.version="v0.0.0" -X main.buildHash=598a3e29bb514d98660d04a088641922ccc020c9 -X main.buildDate=2020-10-05T16:52:56Z" -o bin/ack-generate cmd/ack-generate/main.go ./scripts/build-controller.sh dynamodb FAIL: Existing version of controller-gen Version: v0.3.1-0.20200716001835-4a903ddb7005, required version is v0.4.0. FAIL: Please uninstall controller-gen and re-run this script, which will install the required version. make[1]: *** [Makefile:49: build-controller] Error 1 make[1]: Leaving directory '/home/jaypipes/go/src/github.com/aws/aws-controllers-k8s' jaypipes@thelio:~/go/src/github.com/aws/aws-controllers-k8s$ sudo rm -f `which controller-gen` jaypipes@thelio:~/go/src/github.com/aws/aws-controllers-k8s$ make build-controller SERVICE=dynamodb make[1]: Entering directory '/home/jaypipes/go/src/github.com/aws/aws-controllers-k8s' go build -tags codegen -ldflags "-X main.version="v0.0.0" -X main.buildHash=598a3e29bb514d98660d04a088641922ccc020c9 -X main.buildDate=2020-10-05T16:53:07Z" -o bin/ack-generate cmd/ack-generate/main.go ./scripts/build-controller.sh dynamodb go: creating new go.mod: module tmp go: found sigs.k8s.io/controller-tools/cmd/controller-gen in sigs.k8s.io/controller-tools v0.4.0 **************************************************************************** WARNING: You may need to reload your Bash shell and path. If you see an error like this following: Error: couldn't find github.com/aws/aws-sdk-go in the go.mod require block simply reload your Bash shell with `exec bash` and then re-run whichever command you were running. **************************************************************************** Building Kubernetes API objects for dynamodb Error: couldn't find github.com/aws/aws-sdk-go in the go.mod require block make[1]: *** [Makefile:49: build-controller] Error 2 make[1]: Leaving directory '/home/jaypipes/go/src/github.com/aws/aws-controllers-k8s' jaypipes@thelio:~/go/src/github.com/aws/aws-controllers-k8s$ exec bash jaypipes@thelio:~/go/src/github.com/aws/aws-controllers-k8s$ make build-controller SERVICE=dynamodb make[1]: Entering directory '/home/jaypipes/go/src/github.com/aws/aws-controllers-k8s' go build -tags codegen -ldflags "-X main.version="v0.0.0" -X main.buildHash=598a3e29bb514d98660d04a088641922ccc020c9 -X main.buildDate=2020-10-05T16:53:21Z" -o bin/ack-generate cmd/ack-generate/main.go ./scripts/build-controller.sh dynamodb Building Kubernetes API objects for dynamodb Generating deepcopy code for dynamodb Generating custom resource definitions for dynamodb Building service controller for dynamodb Generating RBAC manifests for dynamodb Running gofmt against generated code for dynamodb make[1]: Leaving directory '/home/jaypipes/go/src/github.com/aws/aws-controllers-k8s' ``` Issue aws-controllers-k8s#349 Related: kubernetes-sigs/controller-tools#500
- Loading branch information