Documentation ¶
Index ¶
- func FlagSet() *flag.FlagSet
- func InitFlags(flagset *flag.FlagSet)
- func RegisterMutatingWebhook[T runtime.Object](w MutatingWebhook[T], scheme *runtime.Scheme, log logr.Logger) error
- func RegisterMutatingWebhookWithRouter[T runtime.Object](w MutatingWebhook[T], scheme *runtime.Scheme, log logr.Logger, router Router) error
- func RegisterValidatingWebhook[T runtime.Object](w ValidatingWebhook[T], scheme *runtime.Scheme, log logr.Logger) error
- func RegisterValidatingWebhookWithRouter[T runtime.Object](w ValidatingWebhook[T], scheme *runtime.Scheme, log logr.Logger, router Router) error
- func RegisterWebhook[T runtime.Object](w Webhook[T], scheme *runtime.Scheme, log logr.Logger) error
- func RegisterWebhookWithRouter[T runtime.Object](w Webhook[T], scheme *runtime.Scheme, log logr.Logger, router Router) error
- func Serve(ctx context.Context, options *ServeOptions) error
- type MutatingWebhook
- type Router
- type ServeOptions
- type ValidatingWebhook
- type Webhook
- type WebhookHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitFlags ¶
Add our flags to specified go flag set. If flagset is nil, the default flag set will be used.
func RegisterMutatingWebhook ¶
func RegisterMutatingWebhook[T runtime.Object](w MutatingWebhook[T], scheme *runtime.Scheme, log logr.Logger) error
Register mutating webhook to be served by Serve(). Must be called before Serve(). The type parameter T can be a pointer to a concrete Kubernetes resource type (such as *corev1.Pod), a pointer to unstructured.Unstructured, or an interface type containing runtime.Object; in the first case, scheme is required and must recognize the supplied resource type; in the second and third case, scheme is ignored (can be passed as nil), and a pointer to unstructured.Unstructured will be passed to the webhook implementation.
func RegisterMutatingWebhookWithRouter ¶
func RegisterMutatingWebhookWithRouter[T runtime.Object](w MutatingWebhook[T], scheme *runtime.Scheme, log logr.Logger, router Router) error
Register mutating webhook with router (such as http.ServeMux or gorilla's mux.Router). The type parameter T can be a pointer to a concrete Kubernetes resource type (such as *corev1.Pod), a pointer to unstructured.Unstructured, or an interface type containing runtime.Object; in the first case, scheme is required and must recognize the supplied resource type; in the second and third case, scheme is ignored (can be passed as nil), and a pointer to unstructured.Unstructured will be passed to the webhook implementation.
func RegisterValidatingWebhook ¶
func RegisterValidatingWebhook[T runtime.Object](w ValidatingWebhook[T], scheme *runtime.Scheme, log logr.Logger) error
Register validating webhook to be served by Serve(). Must be called before Serve(). The type parameter T can be a pointer to a concrete Kubernetes resource type (such as *corev1.Pod), a pointer to unstructured.Unstructured, or an interface type containing runtime.Object; in the first case, scheme is required and must recognize the supplied resource type; in the second and third case, scheme is ignored (can be passed as nil), and a pointer to unstructured.Unstructured will be passed to the webhook implementation.
func RegisterValidatingWebhookWithRouter ¶
func RegisterValidatingWebhookWithRouter[T runtime.Object](w ValidatingWebhook[T], scheme *runtime.Scheme, log logr.Logger, router Router) error
Register validating webhook with router (such as http.ServeMux or gorilla's mux.Router). The type parameter T can be a pointer to a concrete Kubernetes resource type (such as *corev1.Pod), a pointer to unstructured.Unstructured, or an interface type containing runtime.Object; in the first case, scheme is required and must recognize the supplied resource type; in the second and third case, scheme is ignored (can be passed as nil), and a pointer to unstructured.Unstructured will be passed to the webhook implementation.
func RegisterWebhook ¶
Register a joint webhook (i.e. being validating and mutating at the same time) to be served by Serve(). Must be called before Serve(). The type parameter T can be a pointer to a concrete Kubernetes resource type (such as *corev1.Pod), a pointer to unstructured.Unstructured, or an interface type containing runtime.Object; in the first case, scheme is required and must recognize the supplied resource type; in the second and third case, scheme is ignored (can be passed as nil), and a pointer to unstructured.Unstructured will be passed to the webhook implementation.
func RegisterWebhookWithRouter ¶
func RegisterWebhookWithRouter[T runtime.Object](w Webhook[T], scheme *runtime.Scheme, log logr.Logger, router Router) error
Register a joint webhook (i.e. being validating and mutating at the same time) with router (such as http.ServeMux or gorilla's mux.Router). The type parameter T can be a pointer to a concrete Kubernetes resource type (such as *corev1.Pod), a pointer to unstructured.Unstructured, or an interface type containing runtime.Object; in the first case, scheme is required and must recognize the supplied resource type; in the second and third case, scheme is ignored (can be passed as nil), and a pointer to unstructured.Unstructured will be passed to the webhook implementation.
Types ¶
type MutatingWebhook ¶
type MutatingWebhook[T runtime.Object] interface { MutateCreate(ctx context.Context, obj T) error MutateUpdate(ctx context.Context, oldObj T, newObj T) error }
Mutating webhook interface. There is no deletion handler because mutating before deletion is meaningless anyway.
type ServeOptions ¶
type ServeOptions struct { // Bind address, such as :2443 or 127.0.0.1:2443 BindAddress string // Path to file containing the server TLS certificate (plus intermediates if present) CertFile string // PAth to file container the server TLS key KeyFile string }
Options for webhook http server. Protocol https (and therefore CertFile and KeyFile) is mandatory
type ValidatingWebhook ¶
type ValidatingWebhook[T runtime.Object] interface { ValidateCreate(ctx context.Context, obj T) error ValidateUpdate(ctx context.Context, oldObj T, newObj T) error ValidateDelete(ctx context.Context, obj T) error }
Validating webhook interface.
type Webhook ¶
type Webhook[T runtime.Object] interface { ValidatingWebhook[T] MutatingWebhook[T] }
Joint interface for a webhook which is both validating and mutating (for convenience).
type WebhookHandler ¶
type WebhookHandler struct {
// contains filtered or unexported fields
}
Webhook handler. Implements the http.Handler interface.
func NewMutatingWebhookHandler ¶
func NewMutatingWebhookHandler[T runtime.Object](w MutatingWebhook[T], scheme *runtime.Scheme, log logr.Logger) *WebhookHandler
Create webhook handler for a mutating webhook. The type parameter T can be a pointer to a concrete Kubernetes resource type (such as *corev1.Pod), a pointer to unstructured.Unstructured, or an interface type containing runtime.Object; in the first case, scheme is required and must recognize the supplied resource type; in the second and third case, scheme is ignored (can be passed as nil), and a pointer to unstructured.Unstructured will be passed to the webhook implementation.
func NewValidatingWebhookHandler ¶
func NewValidatingWebhookHandler[T runtime.Object](w ValidatingWebhook[T], scheme *runtime.Scheme, log logr.Logger) *WebhookHandler
Create webhook handler for a validating webhook. The type parameter T can be a pointer to a concrete Kubernetes resource type (such as *corev1.Pod), a pointer to unstructured.Unstructured, or an interface type containing runtime.Object; in the first case, scheme is required and must recognize the supplied resource type; in the second and third case, scheme is ignored (can be passed as nil), and a pointer to unstructured.Unstructured will be passed to the webhook implementation.
func (*WebhookHandler) ServeHTTP ¶
func (h *WebhookHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
Serve admission http request.