webhook

package
v0.119.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LandscaperDeploymentsResourceType = "landscaperdeployments"
	InstancesResourceType             = "instances"
	ServiceTargetConfigsResourceType  = "servicetargetconfigs"
	TargetSchedulingsResourceType     = "targetschedulings"
)

Variables

This section is empty.

Functions

func DeleteValidatingWebhookConfiguration

func DeleteValidatingWebhookConfiguration(ctx context.Context, kubeClient client.Client, name string) error

DeleteValidatingWebhookConfiguration deletes a ValidatingWebhookConfiguration

func GetCachelessClient

func GetCachelessClient(restConfig *rest.Config) (client.Client, error)

GetCachelessClient is a helper function that returns a client that can be used before the manager is started

func RegisterWebhooks

func RegisterWebhooks(ctx context.Context, webhookServer ctrlwebhook.Server, client client.Client, scheme *runtime.Scheme, o Options) error

RegisterWebhooks generates certificates and registers the webhooks to the manager no-op if WebhookedResources in the given options is either nil or empty

func UpdateValidatingWebhookConfiguration

func UpdateValidatingWebhookConfiguration(ctx context.Context, kubeClient client.Client, o Options) error

UpdateValidatingWebhookConfiguration will create or update a ValidatingWebhookConfiguration

Types

type GenericValidator

type GenericValidator interface {
	Handle(context.Context, admission.Request) admission.Response
}

GenericValidator is an abstraction interface that implements admission.Handler and contains additional setter functions for the fields

func ValidatorFromResourceType

func ValidatorFromResourceType(log logging.Logger, kubeClient client.Client, scheme *runtime.Scheme, resource string) (GenericValidator, error)

ValidatorFromResourceType is a helper method that gets a resource type and returns the fitting validator

type InstanceValidator

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

InstanceValidator represents a validator for an Instance

func (*InstanceValidator) Handle

Handle handles a request to the webhook

type LandscaperDeploymentValidator

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

LandscaperDeploymentValidator represents a validator for a LandscaperDeployment

func (*LandscaperDeploymentValidator) Handle

Handle handles a request to the webhook

type Options

type Options struct {
	// Name of the ValidatingWebhookConfiguration that will be created
	WebhookConfigurationName string
	// the webhooks will be named <resource><webhook suffix>
	WebhookNameSuffix string
	// base path for the webhooks, the resource name will be appended
	WebhookBasePath string
	// name of the service under which the webhook can be reached
	ServiceName string
	// namespace of the service
	ServiceNamespace string
	// port of the service
	ServicePort int32
	// LabelSelector that is used to filter all resources handled by this webhook
	ObjectSelector metav1.LabelSelector
	// the resources that should be handled by this webhook
	WebhookedResources []WebhookedResourceDefinition
	// certificates for the webhook
	CABundle []byte
}

Options contains the configuration that is necessary to create a ValidatingWebhookConfiguration

type ServiceTargetConfigValidator

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

ServiceTargetConfigValidator represents a validator for a ServiceTargetConfig

func (*ServiceTargetConfigValidator) Handle

Handle handles a request to the webhook

type TargetSchedulingValidator

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

func (*TargetSchedulingValidator) Handle

Handle handles a request to the webhook

type WebhookedResourceDefinition

type WebhookedResourceDefinition struct {
	// APIGroup of the resource
	APIGroup string
	// all APIVersions of the resource that should be handled
	APIVersions []string
	// name of the resource, lower-case plural form
	ResourceName string
}

WebhookedResourceDefinition contains information about the resources that should be watched by the webhook

Jump to

Keyboard shortcuts

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