Skip to content

Commit 7d971bc

Browse files
author
Mengqi Yu
committed
address comments
1 parent 8a255d3 commit 7d971bc

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

pkg/doc.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,10 @@ system must be read for each Reconciler.
5151
5252
Webhook
5353
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.
5758
5859
There are 2 types of admission webhook: mutating and validating admission webhook.
5960
Mutating webhook is used to mutate a core API object or a CRD instance before the API server admits it.

pkg/webhook/admission/builder/doc.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ limitations under the License.
1717
/*
1818
Package builder provides methods to build admission webhooks.
1919
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.
2321
2422
webhook1, err := NewWebhookBuilder().
2523
Mutating().
@@ -82,7 +80,11 @@ Here is another example:
8280
// handle error
8381
}
8482
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.
8688
Here is an example:
8789
8890
webhook4, err := NewWebhookBuilder().

pkg/webhook/doc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ limitations under the License.
1717
/*
1818
Package webhook provides methods to build and bootstrap a webhook server.
1919
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.
2121
2222
Build webhooks
2323

0 commit comments

Comments
 (0)