webhooks

package
v0.3.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2022 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Module

func Module() fx.Option

Module is a fx module that provides annotated http server using the default listener and kubernetes registry.

Types

type K8sRegistry

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

K8sRegistry allows registering k8s webhooks as validators.

func (*K8sRegistry) RegisterValidator

func (r *K8sRegistry) RegisterValidator(path string, validator Validator)

RegisterValidator adds a validator to be handled on a given HTTP path

This function should be only called before Start phase.

type Validator

type Validator interface {
	// ValidateObject validates an object given in admission.Request
	//
	// returns:
	// * true, "", nil if object passes validation
	// * false, msg, nil if object fails validation
	// * false, "", err if validator itself fails
	//
	// Note: if validator is "not interested" in a given object, it should
	// return true.
	ValidateObject(
		ctx context.Context,
		req *admissionv1.AdmissionRequest,
	) (ok bool, msg string, err error)
}

Validator is an interface for k8s validating webhooks.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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