File tree Expand file tree Collapse file tree 3 files changed +11
-8
lines changed Expand file tree Collapse file tree 3 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -51,9 +51,10 @@ system must be read for each Reconciler.
51
51
52
52
Webhook
53
53
54
- Admission Webhooks are a mechanism for extending kubernetes APIs. The API server will send AdmissionRequests to
55
- the webhooks according to the configured target event type (object Create, Update, Delete). The webhooks may
56
- mutate and (or) validate the object embedded in the AdmissionReview requests.
54
+ Admission Webhooks are a mechanism for extending kubernetes APIs. Webhooks can be configured with target
55
+ event type (object Create, Update, Delete), the API server will send AdmissionRequests to them
56
+ when certain events happen. The webhooks may mutate and (or) validate the object embedded in
57
+ the AdmissionReview requests and send back the response to the API server.
57
58
58
59
There are 2 types of admission webhook: mutating and validating admission webhook.
59
60
Mutating webhook is used to mutate a core API object or a CRD instance before the API server admits it.
Original file line number Diff line number Diff line change @@ -17,9 +17,7 @@ limitations under the License.
17
17
/*
18
18
Package builder provides methods to build admission webhooks.
19
19
20
- For most users, we recommend to use Operations and ForType to construct a webhook,
21
- since it is more intuitive and easier to pass the target operations to Operations method and
22
- a empty target object to ForType method than passing a complex RuleWithOperations struct to Rules method.
20
+ The following are 2 examples for building mutating webhook and validating webhook.
23
21
24
22
webhook1, err := NewWebhookBuilder().
25
23
Mutating().
@@ -82,7 +80,11 @@ Here is another example:
82
80
// handle error
83
81
}
84
82
85
- For some advanced use cases like subresources, etc., you can directly use Rules instead of use Operations and ForType.
83
+ For most users, we recommend to use Operations and ForType instead of Rules to construct a webhook,
84
+ since it is more intuitive and easier to pass the target operations to Operations method and
85
+ a empty target object to ForType method than passing a complex RuleWithOperations struct to Rules method.
86
+
87
+ Rules may be useful for some more advanced use cases like subresources, wildcard resources etc.
86
88
Here is an example:
87
89
88
90
webhook4, err := NewWebhookBuilder().
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ limitations under the License.
17
17
/*
18
18
Package webhook provides methods to build and bootstrap a webhook server.
19
19
20
- Currently, it only supports hosting admission webhooks.
20
+ Currently, it only supports admission webhooks. It will support CRD conversion webhooks in the near future .
21
21
22
22
Build webhooks
23
23
You can’t perform that action at this time.
0 commit comments