-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
✨ Added support for empty group in kubebuilder api creation with v3+ #1404 #1679
Conversation
Welcome @prafull01! |
Hi @prafull01. 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. |
/ok-to-test |
/retest |
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.
Thank you for seeing #1404 through! I had some minor nits, but this looks good to me :)
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.
HI @prafull01.,
Really thank you for the contribution 👍 It is great. IMO we need to apply this only to v3+, we need make the tool be able to work with empty groups instead of replacing the empty string by core and it is missing this scenario to the generate_testadata.sh script.
However, it is great that you are looking for to address this need.
Also, could you please update the title with the mojo: https://github.com/kubernetes-sigs/kubebuilder/blob/master/CONTRIBUTING.md#pr-process and add (v3+ only)? Also, please ensure that your commits are squashed. |
ae06d8c
to
caae428
Compare
@@ -25,4 +25,6 @@ resources: | |||
- group: foo.policy | |||
kind: HealthCheckPolicy | |||
version: v1 | |||
- kind: Lakers | |||
version: v1 |
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.
👍
c67b64f
to
0766756
Compare
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.
/approve
Great work 🥇
5653d66
to
7ca5db1
Compare
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: camilamacedo86, prafull01 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
||
By("bootstrapping test environment") | ||
testEnv = &envtest.Environment{ | ||
CRDDirectoryPaths: []string{filepath.Join("..", "config", "crd", "bases")}, |
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.
👍
/test pull-kubebuilder-e2e-k8s-1-17-0 |
Hi @prafull01, The coveralls check is not passing because it is missing cover the ValidateV2 with all same checks that is done for Validate + the group one. See: https://coveralls.io/builds/33545877/source?filename=pkg/model/resource/options.go#L88 |
There are two ways I can handle it:
How should we handle this? |
I think would be fine just duplicate as well. We can remove the tests when the V2 be removed. Please, feel free to choose the way that you think that it would be better. |
7ca5db1
to
e468c46
Compare
/test pull-kubebuilder-e2e-k8s-1-14-1 |
/assign @camilamacedo86 |
/assign @DirectXMan12 |
minor nit: the commit message mentions the "core" directory, but that bit seems gone. Can you fix up the commit message. AIUI, with multigroup we'll end up with
Is that correct? |
(otherwise, I delegate to @camilamacedo86 for the lgtm ;-) ) |
Fixed the commit message. Yes, the path you mentioned is correct for empty group and non empty group. |
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.
I had one nit about what looked like an unnecessary check, but otherwise this looks good to me!
@@ -137,6 +137,10 @@ func (p *createAPIPlugin) Validate() error { | |||
return err | |||
} | |||
|
|||
if p.resource.Group == "" && p.config.Domain == "" { |
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.
I think this check is redundant, given that p.resource.Validate()
(called above) never allows p.Config.Domain to be an empty string in the first place?
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.
@gabbifish IMO this is a necessary check, while initializing a project (kb init) you can provide a domain which can be empty.
Validate() function doesn't check the value of domain, it only checks the group, version, kind and related values which are provided in create api command. (kb create api). Domain is provided at the init level. Hence this check is necessary to know a user do not provide domain and group both as empty.
e468c46
to
664f8c6
Compare
@camilamacedo86 Rebase done. |
/test pull-kubebuilder-e2e-k8s-1-15-3 |
It shows great for me. I could not find any issue with that. So, it shows fine for we move forward |
Description of the change:
Motivation for the change:
It will improve user experience in api creation using kubebuilder.
It will solve the workarounds used by user to just have their domain name as the apiVersion.
Fixes #1404