Skip to content

Commit 17c28db

Browse files
authored
Merge pull request #5159 from kubernetes-sigs/copilot/fix-cronjob-webhook-versions-again
📖 (multiversion-tutorial): Show v2 webhook implementation alongside v1
2 parents 271effe + 92d01ff commit 17c28db

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

docs/book/src/multiversion-tutorial/webhooks.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,21 @@
33
Our conversion is in place, so all that's left is to tell
44
controller-runtime about our conversion.
55

6-
## Webhook setup...
6+
## Webhook setup for v1...
7+
8+
The v1 webhook handles conversion (as the hub) and provides validation/defaulting
9+
for the v1 CronJob format with a string-based schedule:
710

811
{{#literatego ./testdata/project/internal/webhook/v1/cronjob_webhook.go}}
912

13+
## Webhook setup for v2...
14+
15+
The v2 webhook provides validation and defaulting for the v2 CronJob format
16+
with the structured CronSchedule type. Note how the validation logic differs
17+
from v1 - it builds a cron expression from the individual schedule fields:
18+
19+
{{#literatego ./testdata/project/internal/webhook/v2/cronjob_webhook.go}}
20+
1021
## ...and `main.go`
1122

1223
Similarly, our existing main file is sufficient:

0 commit comments

Comments
 (0)