Documentation
¶
Overview ¶
Package webhook provides kubernetes webhook resource business logic.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type WebhookController ¶
type WebhookController interface {
// GetSupported returns a nested map structure that indicates the supported
// Group-Version-Kind (GVK) combinations for the webhook controller.
//
// Returns:
// - map[string]map[string]map[string]metav1.Object: A nested map where the first
// key represents the API group, the second key represents the API version,
// and the third key represents the kind. The value is a metav1.Object
// representing the supported resource.
GetSupported() map[string]map[string]map[string]metav1.Object
// IsSupported checks whether a specific Group-Version-Kind (GVK)
// combination is supported for GET operations by the webhook controller.
//
// Parameters:
// - g: The API group of the resource.
// - v: The API version of the resource.
// - k: The kind of the resource.
//
// Returns:
// - bool: True if the specified GVK combination is supported for GET operations,
// otherwise false.
IsSupported(g, v, k string) bool
// GetConfigurationAccessor retrieves the configuration accessor for a specific
// Group-Version-Kind (GVK) combination, if it is registered.
//
// Parameters:
// - g: The API group of the resource.
// - v: The API version of the resource.
// - k: The kind of the resource.
//
// Returns:
// - config.ConfigAccessor: The configuration accessor for the specified GVK,
// or nil if the GVK is not registered.
GetConfigurationAccessor(g, v, k string) config.ConfigAccessor
// Review processes an AdmissionReview request and determines whether the request
// should be allowed or denied. It dispatches the request to the appropriate handler
// based on the resource's G/V/R or falls back to the default handler if no specific
// handler is registered.
//
// Parameters:
// - ctx: The context for the request, used for cancellation and deadlines.
// - ar: The AdmissionReview containing details about the resource and operation.
//
// Returns:
// - *types.AdmissionResponse: The result of the admission process, indicating
// whether the request is allowed or denied.
// - error: Any error encountered during processing.
Review(ctx context.Context, ar *types.AdmissionReview) (*types.AdmissionResponse, error)
}
WebhookController defines the interface for handling AdmissionReview requests. It provides a method to process incoming requests and route them to the appropriate handler based on the resource's Group, Version, and Resource (G/V/R). If no specific handler is registered, the default handler is used to allow the request by default.
func NewWebhookFactory ¶
func NewWebhookFactory(store types.ResourceStore, settings *config.Settings, clock types.TimeProvider) (WebhookController, error)
NewWebhookFactory creates and initializes a new WebhookController instance. It sets up default handlers, registers resource-specific handlers, and initializes metrics.
Parameters:
- store: A ResourceStore instance used for storing resources.
- settings: A Settings instance containing configuration for the webhook.
- clock: A TimeProvider instance for time-related operations.
Returns:
- *WebhookController: The initialized WebhookController instance.
- error: An error if the initialization fails.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package backfiller provides functionality to backfill Kubernetes Resource objects, and if enabled invokes the webhook domain logic
|
Package backfiller provides functionality to backfill Kubernetes Resource objects, and if enabled invokes the webhook domain logic |
|
Package handler admission webhook handlers (hook.Handler) for various resource types.
|
Package handler admission webhook handlers (hook.Handler) for various resource types. |
|
Package helper contains decode helper methods for transforming kubernetes metav1.Objects into K8sObjects
|
Package helper contains decode helper methods for transforming kubernetes metav1.Objects into K8sObjects |
|
Package hook contains structures and interfaces for implementing admission webhooks handlers.
|
Package hook contains structures and interfaces for implementing admission webhooks handlers. |
Click to show internal directories.
Click to hide internal directories.