Skip to content

Commit 2ea06af

Browse files
authored
Merge pull request #1147 from anyasabo/webhookdocs
Add webhook scaffolding to docs
2 parents 0824a13 + 0a274ac commit 2ea06af

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

docs/book/src/cronjob-tutorial/webhook-implementation.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,12 @@ Kubebuilder takes care of the rest for you, such as
1111
1. Creating handlers for your webhooks.
1212
1. Registering each handler with a path in your server.
1313

14+
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):
15+
16+
```bash
17+
kubebuilder create webhook --group batch --version v1 --kind CronJob --defaulting --programmatic-validation
18+
```
19+
20+
This will scaffold the webhook functions and register your webhook with the manager in your `main.go` for you.
21+
1422
{{#literatego ./testdata/project/api/v1/cronjob_webhook.go}}

docs/book/src/reference/markers/webhook.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Webhook
22

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

0 commit comments

Comments
 (0)