-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
✨ Continue to fix scaffolding hub and spoke interfaces #3058
Conversation
I don't understand how to fix https://github.com/kubernetes-sigs/kubebuilder/pull/2084/files#r599386603 and https://github.com/kubernetes-sigs/kubebuilder/pull/2084/files#r599404131. |
/ok-to-test |
resource: resource, | ||
force: force, | ||
doScaffold: doScaffold, | ||
spoke: spoke, |
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.
Why do we need to pass it here?
Could not the value be in the config?
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 doScaffold
and spoke
come from option when user type like kubebuilder create webhook --group crew --version v1 --kind FirstKind --conversion --hub v1 --spoke v2
and these can't be gotten from config.
Is my understanding right?
if !p.resource.HasDefaultingWebhook() && !p.resource.HasValidationWebhook() && !p.resource.HasConversionWebhook() { | ||
return fmt.Errorf("%s create webhook requires at least one of --defaulting,"+ | ||
" --programmatic-validation and --conversion to be true", p.commandName) | ||
" --programmatic-validation, --conversion, and --spoke to be provided", p.commandName) |
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.
Why and? Is not and/OR
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'm not good at English so I just reflected this comment. But as you said, I think spoke
option is optional so likefmt.Errorf("%s create webhook requires at least one of --defaulting,"+" --programmatic-validation and --conversion to be true. If using conversion webhook"+ "you can specify the spoke versions in the command.", p.commandName)
is better?
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.
Is possible to use --conversion with spoke and --programmatic-validation with spoke or not?
So, I think we need to clarify it in the text.
@@ -59,7 +59,14 @@ function scaffold_test_project { | |||
else | |||
$kb create api --group crew --version v1 --kind FirstMate --controller=true --resource=true --make=false | |||
fi | |||
$kb create webhook --group crew --version v1 --kind FirstMate --conversion |
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.
We need to that for project-v4 as well.
@@ -16,6 +16,8 @@ resources: | |||
version: v1 | |||
webhooks: | |||
defaulting: true | |||
spokes: | |||
- "" |
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.
Why the version? What does mean the version?
What are the valid version options?
Should not it be a bool with true like the other ones?
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.
@camilamacedo86 @varshaprasad96
#3058 (comment)
As you said before, I think we can just take the boolean option whether it is hub or spoke and create Hub(), ConvertTo() or ConvertFrom() template. For instance kubebuilder create webhook --version v1 --hub.
What do you think?
Note that kubebuilder create webhook --version v1 --hub.
The version is for teh webhook and not spoke, So, why are you adding an version to spoke? Look how the others options for webhooks are tracked. Example conversion: true
. So, it shows for me that should be a boolean.
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.
@camilamacedo86
I agree with you. And I've not changed yet since @/varshaprasad96' PR. I just fixed the points where the reviewers mentioned in that PR.
And I'd like to confirm to you whether I can change this PR to take only one boolean option or not in advance because it's going to be a big change.
As I mentioned before, example usage I'm supposed is like kubebuilder create webhook --version v1 --conversion --hub
or kubebuilder create webhook --version v1 --conversion --spoke.
If user entered kubebuilder create webhook --version v1 --hub
(it implies conversion is true) , it will create Hub()
skeleton code under project/api/v1/{resource}_conversion.go
.
If user entered kubebuilder create webhook --version v2 --spoke
, it will create ConvertTo()
or ConvertFrom()
skeleton code under project/api/v2/{resource}_conversion.go
.
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.
/hold
Until we are able to address all changes and review.
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: momom-i 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 |
Unknown CLA label state. Rechecking for CLA labels. Send feedback to sig-contributor-experience at kubernetes/community. /check-cla |
1d62f44
to
068d9a1
Compare
@@ -189,6 +189,20 @@ func (c cfg) GetResources() ([]resource.Resource, error) { | |||
return resources, nil | |||
} | |||
|
|||
// ListResourcesWithGK implements config.Config | |||
func (c cfg) ListResourcesWithGK(gvk resource.GVK) []resource.Resource { |
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.
wondering if we need these changes in v2 plugin, since we will be deprecating it soon.
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.
We should not change the v2 +1 Good Point.
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 understand.
machinery.ResourceMixin | ||
|
||
// Version refers to the conversion webhook versions for hub and spoke. | ||
Version string |
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.
Could you please elaborate on how the command would like like? I remember there were many questions and discussions on the previous PR regarding the same. It will really helpful to revisit the command UX.
@camilamacedo86 @varshaprasad96 |
@momom-i: 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/test-infra repository. |
@momom-i: The following tests 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. |
I'll close this PR because I recreated the PR. #3201 |
This PR is the rest of #2084.
Details more on above PR.
Related issue: #2589