-
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
✨ scaffold the webhook builder #816
Conversation
cmd/api.go
Outdated
@@ -48,6 +48,9 @@ func (o *apiOptions) bindCmdFlags(cmd *cobra.Command) { | |||
cmd.Flags().BoolVar(&o.apiScaffolder.DoController, "controller", true, | |||
"if set, generate the controller without prompting the user") | |||
o.controllerFlag = cmd.Flag("controller") | |||
cmd.Flags().BoolVar(&o.apiScaffolder.DoWebhook, "webhook", false, |
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.
do we want to differentiate from "manual" webhooks (i.e. not our special defaulting/validating)?
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.
Discussed with Solly offline. We can have something like kubebuilder create webhook --low-level-defaulting --low-level-programmatic-validation
for "manual" webhooks if we want to do it in the future.
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.
Filed tracking issue #833
discussed this a bit more -- we probably want a separate subcommand for enabling this |
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.
Change looks good except that we want to have a separate subcommand to enable webhooks.
09126a1
to
2438fc5
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.
Mostly looks good. I have a few questions/comments.
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.
Looks good, have a minor comments.
Thanks for updating the e2e tests.
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.
Looks good. A couple of minor nits.
I didn't add it in the existing example intentionally, since from our earlier offline discussion. I don't know why GH doesn't allow me to reply under it. :/ |
@droot @DirectXMan12 PTAL |
Travis still has a lot of backlog now: https://www.traviscistatus.com/incidents/g9xm3l02dknv |
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.
Looks good to me.
add a new command `kubebuilder create webhook` to scaffold the webhooks. --defaulting, --imperative-validation and --converison can be used to scaffold mutating, validating and conversion webhooks.
If PROJECT doesn't exist or PROJECT exists with version=2, register `create webhook`, but no `alpha webhook`. If PROJECT exists and version=1, register `alpha webhook` but no `create webhook`
@droot Should be ready to ship now. |
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: droot, mengqiy 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 |
Add a new command
kubebuilder create webhook
for user to scaffold webhook.Kubebuilder now dynamically register commands based on metadata in PROJECT.
If PROJECT doesn't exist or PROJECT exists with version=2, register
create webhook
, but noalpha webhook
.If PROJECT exists and version=1, register
alpha webhook
but nocreate webhook