-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
CRD generation via generate openapi
does not surface errors for invalid tags
#2042
Comments
/cc @estroz |
I believe I'm running into something similar. After upgrading to v0.11.0, I had to add the |
Hi @robbie-demuth, Really thank you for your contribution. We will check this issue. However, in order to help you solve the problems in your project, I'd recommend checking the steps in the migration doc in order to ensure that nothing is missing. Mainly the required annotations. Another good approach which could be helpful is to create a new project as described in the QuickStart here just to compare the annotations and CRD's so far. Also, I'd like to share a PR with migration from 0.10 to 0.11 / master in a personal project which may help you find out what is missing. See here I hope that it helps you. |
I scaffolded two new projects using v0.9.0 and v0.11.0 to compare the differences and applied them to the project I'm working on, so I thought I got them all. That being said, I tried building out some simple types in a new v0.11.0 project and it seems to be working, so I'll try building from the ground up and seeing where I went wrong. I'll report back here once I've got more info. Thanks! |
So after a bit of digging, I figured out my issue. There were two things going on:
EDIT The second issue was caused by a change in the way that Enums need to be defined. Previously, separating Enum values via commas was fine, but now, they need to be enclosed in curly braces or separated using semicolons https://book.kubebuilder.io/reference/markers.html |
Hi @robbie-demuth, Really tks to share it. Just to register for it be easier for the others. So, from the SDK which is missing is just shown what is wrong(output error msgs). Also, maybe we need to check the Enum type as well. |
Thanks @robbie-demuth for sharing your results. I was also bitten by the change to the Enums and you saved me from a debugging session :-) |
Okay, folks this needs a word in the upgrade guide, please. I was updating the operator-sdk from 0.10 tu 0.11 and this Enum change described by @robbie-demuth took me 1,5 days to figure out / find this issue. |
Hi @apinnecke, The #2111 was created for it. Feel free to follow up. |
@robbie-demuth @jpkrohling @apinnecke out of curiosity, do you use the generated Go OpenAPI spec ( |
To be honest, I haven't ever really looked at it. I don't believe our organization uses it. We mainly just need the generated |
@camilamacedo86 No, those |
I faced this issue using the wrong type in my
Would work, but as I bumped to 0.12.0:
It was wrong from the start, but it took me some time to find it out, give the error message. |
@CharlyF thanks for sharing your experience; the lack of errors being surfaced is a bad experience for sure. Ensuring |
This should be fixed by #2201, which directly uses Note that |
Bug Report
What did you do?
Run
operator-sdk generate openapi
for the followingpkg/apis/..._types.go
file that has the invalid marker comment// +kubebuilder:resource:foo=bar
.What did you expect to see?
An error message on which marker is invalid.
What did you see instead? Under which circumstances?
No error from the actual controller-gen CRD generator is being surfaced.
Environment
operator-sdk version: "v0.10.0-84-g8132d358", commit: "8132d3588c988b12907e541e5069e9ff7a9fcc55", go version: "go1.12.7 darwin/amd64"
go version: 1.12.7
Additional context
The wrapped error message
Error: error generating CRD ...
suggests that this might just be a lack of context being surfaced from the CRD generator.operator-sdk/internal/pkg/scaffold/crd.go
Lines 167 to 170 in 8132d35
https://github.com/kubernetes-sigs/controller-tools/blob/83f6193614de0a51c4bd5af02650c577034c6a4c/pkg/crd/gen.go#L54
Going to test this directly with controller-gen to see if the issue is upstream.
The text was updated successfully, but these errors were encountered: