builder

package
v1.4.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithCustomDefaulter

func WithCustomDefaulter(obj runtime.Object, defaulter CustomDefaulter) *admission.Webhook

WithCustomDefaulter creates a new Webhook for a CustomDefaulter interface.

func WithCustomValidator

func WithCustomValidator(obj runtime.Object, validator CustomValidator) *admission.Webhook

WithCustomValidator creates a new Webhook for validating the provided type.

Types

type CustomDefaulter

type CustomDefaulter interface {
	Default(ctx context.Context, obj runtime.Object, req admission.Request) error
}

CustomDefaulter defines functions for setting defaults on resources.

type CustomValidator

type CustomValidator interface {
	ValidateCreate(ctx context.Context, obj runtime.Object, req admission.Request) error
	ValidateUpdate(ctx context.Context, oldObj, newObj runtime.Object, req admission.Request) error
	ValidateDelete(ctx context.Context, obj runtime.Object, req admission.Request) error
}

CustomValidator defines functions for validating an operation.

type WebhookBuilder

type WebhookBuilder struct {
	// contains filtered or unexported fields
}

WebhookBuilder builds a Webhook.

func WebhookManagedBy

func WebhookManagedBy(m manager.Manager) *WebhookBuilder

WebhookManagedBy allows inform its manager.Manager.

func (*WebhookBuilder) Complete

func (blder *WebhookBuilder) Complete() error

Complete builds the webhook.

func (*WebhookBuilder) For

func (blder *WebhookBuilder) For(apiType runtime.Object) *WebhookBuilder

For takes a runtime.Object which should be a CR. If the given object implements the admission.Defaulter interface, a MutatingWebhook will be wired for this type. If the given object implements the admission.Validator interface, a ValidatingWebhook will be wired for this type.

func (*WebhookBuilder) WithDefaulter

func (blder *WebhookBuilder) WithDefaulter(defaulter CustomDefaulter) *WebhookBuilder

WithDefaulter takes a WithDefaulter interface, a MutatingWebhook will be wired for this type.

func (*WebhookBuilder) WithValidator

func (blder *WebhookBuilder) WithValidator(validator CustomValidator) *WebhookBuilder

WithValidator takes a WithValidator interface, a ValidatingWebhook will be wired for this type.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL