Skip to content

Commit

Permalink
Add webhook scaffolding to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
anyasabo committed Nov 1, 2019
1 parent 746316d commit 0a274ac
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions docs/book/src/cronjob-tutorial/webhook-implementation.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,12 @@ Kubebuilder takes care of the rest for you, such as
1. Creating handlers for your webhooks.
1. Registering each handler with a path in your server.

First, let's scaffold the webhooks for our CRD (CronJob). We’ll need to run the following command with the `--defaulting` and `--programmatic-validation` flags (since our test project will use defaulting and validating webhooks):

```bash
kubebuilder create webhook --group batch --version v1 --kind CronJob --defaulting --programmatic-validation
```

This will scaffold the webhook functions and register your webhook with the manager in your `main.go` for you.

{{#literatego ./testdata/project/api/v1/cronjob_webhook.go}}
2 changes: 1 addition & 1 deletion docs/book/src/reference/markers/webhook.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Webhook

These markers describe how [webhook configuration](/TODO.md) is generated.
These markers describe how [webhook configuration](../webhook-overview.md) is generated.
Use these to keep the description of your webhooks close to the code that
implements them.

Expand Down

0 comments on commit 0a274ac

Please sign in to comment.