Skip to content

Wrong CustomResourceDefinition for buckets.s3.services.k8s.aws #349

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ricardo-larosa opened this issue Sep 29, 2020 · 0 comments
Closed
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@ricardo-larosa
Copy link
Contributor

ricardo-larosa commented Sep 29, 2020

Describe the bug
Changes in #317 are not the same when you run make build-controller SERVICE=s3 and revert version of controller-gen.kubebuilder.io/version from v0.4.0 (latest) to v0.3.1-0.20200716001835-4a903ddb7005
For more context check #295

Steps to reproduce

Run: make build-controller SERVICE=s3

Expected outcome
No changes in s3.services.k8s.aws_buckets.yaml

  • AWS service targeted
    S3
@ricardo-larosa ricardo-larosa added the kind/bug Categorizes issue or PR as related to a bug. label Sep 29, 2020
jaypipes added a commit to jaypipes/aws-controllers-k8s that referenced this issue Oct 5, 2020
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
jaypipes added a commit to jaypipes/aws-controllers-k8s that referenced this issue Oct 6, 2020
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
jaypipes added a commit to jaypipes/aws-controllers-k8s that referenced this issue Oct 6, 2020
controller-gen 0.4.0 is now our standard build tooling and produces CRD
and Role files that are annotated with a specific version of the tool
that built them.

This patch simply updates all the service controllers to align with that
controller-gen 0.4.0 standard.

Fixes Issue aws-controllers-k8s#349
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants