@@ -57,13 +57,13 @@ pub enum MutatingWebhookError {
5757/// // The context of the controller, e.g. contains a Kubernetes client
5858/// let ctx = Arc::new(());
5959/// // Read in from user input, e.g. CLI arguments
60- /// let disable_restarter_mutating_webhook = false;
60+ /// let disable_mutating_webhook_configuration_maintenance = false;
6161///
6262/// let mutating_webhook = Box::new(MutatingWebhook::new(
6363/// get_mutating_webhook_configuration(),
6464/// my_handler,
6565/// ctx,
66- /// disable_restarter_mutating_webhook ,
66+ /// disable_mutating_webhook_configuration_maintenance ,
6767/// client,
6868/// "my-field-manager".to_owned(),
6969/// ));
@@ -95,25 +95,37 @@ pub enum MutatingWebhookError {
9595/// }
9696/// ```
9797pub struct MutatingWebhook < H , S , R > {
98+ /// The [`MutatingWebhookConfiguration`] that is applied to the Kubernetes cluster.
99+ ///
100+ /// Your [`MutatingWebhookConfiguration`] can contain 0..n webhooks, but it is recommended to
101+ /// only have a single entry in there, as the clientConfig of all entries will be set to the
102+ /// same service, port and HTTP path.
103+ ///
104+ /// All webhooks need to set the `admissionReviewVersions` to `["v1"]`, as this mutating webhook
105+ /// only supports that version! A failure to do so will result in a panic during the
106+ /// [`MutatingWebhook`] creation.
98107 mutating_webhook_configuration : MutatingWebhookConfiguration ,
108+
109+ /// The async handler that get's a [`AdmissionRequest`] and returns an [`AdmissionResponse`]
99110 handler : H ,
111+
112+ /// The internal state of the webhook. You can define yourself what exactly this state is.
100113 handler_state : Arc < S > ,
114+
115+ /// This field is not needed, it only tracks the type of the Kubernetes resource we are mutating
101116 _resource : PhantomData < R > ,
102117
118+ /// Whether MutatingWebhookConfigurations should be maintained
103119 disable_mutating_webhook_configuration_maintenance : bool ,
120+
121+ /// The Kubernetes client used to maintain the MutatingWebhookConfigurations
104122 client : Client ,
105123
106- /// The field manager used when maintaining the MutatingWebhookConfigurations.
124+ /// The field manager used when maintaining the MutatingWebhookConfigurations
107125 field_manager : String ,
108126}
109127
110128impl < H , S , R > MutatingWebhook < H , S , R > {
111- /// All webhooks need to set the admissionReviewVersions to `["v1"]`, as this mutating webhook
112- /// only supports that version! A failure to do so will result in a panic.
113- ///
114- /// Your [`MutatingWebhookConfiguration`] can contain 0..n webhooks, but it is recommended to
115- /// only have a single entry in there, as the clientConfig of all entries will be set to the
116- /// same service, port and HTTP path.
117129 pub fn new (
118130 mutating_webhook_configuration : MutatingWebhookConfiguration ,
119131 handler : H ,
0 commit comments