-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Bug fix:'operator-sdk add crd' doesn't work after add kubebuilder tags #1660
Conversation
Hi @xm2. Thanks for your PR. I'm waiting for a operator-framework or openshift member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
cc @estroz ^ |
/ok-to-test |
Does running EDIT: The reason that command works is because it sets the repo field of |
@xm2 can you rebase onto/merge with |
@xm2 Since this is a bug fix, can you please add a line to the Bugfix section of the CHANGELOG in the same format as the other changelogs. @estroz PTAL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Co-Authored-By: Eric Stroczynski <estroczy@redhat.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
@xm2 you'll have to merge your branch with master to fix the CI error unfortunately. |
New changes are detected. LGTM label has been removed. |
@xm2 awesome, and thanks for the PR! |
Description of the change:
Bug fix: 'operator-sdk add crd' doesn't work after add kubebuilder tags in _types.go
Motivation for the change:
kubebuilder
tags in _types.go files, e.g. validation tag or scale subresource tag,operator-sdk add crd --api-version=app.example.com/v1alpha1 --kind=AppService
to re-generated crd yaml based on new kubebuilder tag, it failed:Root cause analysis:
From investigation, this error is reported when the
Repo
in input.Config is not set and no "PROJECT" file in project root path when callValidateAndInitFields()
incontroller-tools/pkg/crd/generator/generator.go
.To fix the error, either add "Repo" in input.Config, or, add "PROJECT"file in project root path.
BUT "PROJECT" is a file in
kubebuilder
generated project, it doesn't exist in operator-sdk project.So in the code change, fix the bug by adding "Repo" in input.Config.
Test Result
After the fix, the _crd.yaml can be generated correctly with new "kubebuilder" tags: