-
Notifications
You must be signed in to change notification settings - Fork 422
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
🐛 Fix controller-tools doesn't support single files as input #864
base: main
Are you sure you want to change the base?
Conversation
|
Welcome @yongxiu! |
Hi @yongxiu. Thanks for your PR. I'm waiting for a kubernetes-sigs 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. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: yongxiu The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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.
@yongxiu would you mind adding some context on how you are solving this to the PR description and/or commit?
Done |
/ok-to-test |
Why not specify the entire folder even if there is a single file in it? |
|
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
lgtom to me, but requires a project owner to have a look :)
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.
/remove-lgtm
based on:
paths is a list of directories, not files
waiting for the out come of the discussion.
There could be multiple files.
In above case, I want to generate webhook for cluster_webhook and machine_webhook in output directory A, while typeBCluster_webhook and typeBMachine_webhook to output directory B.
While, at least the command line example is using single file as well: controller-tools/cmd/controller-gen/main.go Line 139 in 881ffb4
|
@vincepri being able to separate output directories like described above sounds useful and it seemed to work before. Is there a clear idea if that should only be dirs, or is it more an interpretation of the word |
@yongxiu, can you add a test that covers using a single file within a directory? The test should probably cover:
My hunch is that the reason that the current code doesn't accept individual files is because the Go AST parser operates on package directories, which makes handling my item (2) above trivial. |
Added webhook integration tests as requested, please take another look, thanks. @joelanford |
Thanks for adding the webhook integration test. That looks good. Can you also add similar tests that cover CRD and RBAC generation? I assume the changes in I'm particularly interested in CRDs with my item (2). If a CRD's types are split between multiple files (say |
@joelanford, added tests for CRDs and rbac as well For the case you mentioned, I have this case in the test, it needs to pass in both files, otherwise it will only shows
To clarify, I also tested controller-tools v0.8.0, it give the same error. |
Not suggesting you go and do this before we see what other maintainers think, but I wonder if we could:
Alternately, another potential option is leaving |
IMHO, detecting the types or add one more input of types is over kill. This feature has been broken for 5 releases, which is 1.5 years, and there is only one bug: #837 for this. I don't see much value of adding types, accepting multiple files which is changing back to 0.8.0 behavior is good enough for most of developers. |
I wonder how can we move this forward? Are we waiting for any other stakeholders? |
Friendly ping! |
@yongxiu: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. I understand the commands that are listed here. |
PR needs rebase. 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-sigs/prow repository. |
@yongxiu @joelanford Hi, Is there any progress on this PR? |
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
@joelanford we would still be interested in that change. Would you have some recommendations on how to move this forward? |
This comment was marked as duplicate.
This comment was marked as duplicate.
/remove-lifecycle rotten |
Fix #837
Below command
Used to work, but didn't work any more since v0.9.0, which is caused by #663. There is a assumption
we want the base part of the path to be either "..." or "."
, this is untrue if user specified a specific file, I added a logic to exclude golang file in this case.Another logic is
uniquePkgIDs
, as from commentthere is not harm that comes from this per se, but it makes testing easier when a known number of modules can be asserted
, this is fine however if there are two files coming from same package, second file will be ignored, thus I have to move this logic to test file.