webhook

package
v1.2.5-alpha.5 Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Overview

Package webhook is a generated GoMock package.

Package webhook implements utility routines related to Kubernetes' admission webhook.

Index

Constants

This section is empty.

Variables

View Source
var (

	// ContentTypeJSON is the supported content type for HTTP requests
	ContentTypeJSON = "application/json"

	// HTTPHeaderContentType is the Content-Type HTTP header key
	HTTPHeaderContentType = "Content-Type"

	// Deserializer is used to decode the admission request body
	Deserializer = codecs.UniversalDeserializer()
)

Functions

func AdmissionError

func AdmissionError(err error) *admissionv1.AdmissionResponse

AdmissionError wraps error as AdmissionResponse

func DefaultingWebhookFor added in v1.1.0

func DefaultingWebhookFor(defaulter Defaulter) *admission.Webhook

DefaultingWebhookFor returns a webhook that defaults the given object.

func GetAdmissionRequestBody

func GetAdmissionRequestBody(w http.ResponseWriter, req *http.Request) ([]byte, error)

GetAdmissionRequestBody returns the body of the admission request

func GetListenerIfHasMatchingPort added in v1.2.0

func GetListenerIfHasMatchingPort(port gwv1beta1.PortNumber, listeners []gwv1beta1.Listener) *gwv1beta1.Listener

func IsValidHostname added in v1.1.0

func IsValidHostname(hostname string) error

IsValidHostname validates the hostname of gateway route resource

func IsValidIPOrCIDR added in v1.2.0

func IsValidIPOrCIDR(value string) []string

IsValidIPOrCIDR tests that the argument is a valid IP address.

func RecordAdmissionMetrics

func RecordAdmissionMetrics(req *admissionv1.AdmissionRequest, resp *admissionv1.AdmissionResponse)

RecordAdmissionMetrics records metrics for the given admission response

func ValidateParentRefs added in v1.1.0

func ValidateParentRefs(refs []gwv1beta1.ParentReference) field.ErrorList

ValidateParentRefs validates the parent refs of gateway route resource

func ValidateRouteHostnames added in v1.1.0

func ValidateRouteHostnames(hostnames []gwv1beta1.Hostname) field.ErrorList

ValidateRouteHostnames validates the hostnames of gateway route resource

func ValidatingWebhookFor added in v1.1.0

func ValidatingWebhookFor(validator Validator) *admission.Webhook

ValidatingWebhookFor returns a new validating webhook for the given validator.

Types

type CertRotatedFunc

type CertRotatedFunc func(cert *certificate.Certificate) error

CertRotatedFunc is a callback to perform other actions when the server's HTTPS cert gets rotated.

type Defaulter added in v1.1.0

type Defaulter interface {
	Object
	SetDefaults(obj interface{})
}

Defaulter is the interface for webhook defaulters

type MockRegister added in v1.1.0

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

MockRegister is a mock of Register interface.

func NewMockRegister added in v1.1.0

func NewMockRegister(ctrl *gomock.Controller) *MockRegister

NewMockRegister creates a new mock instance.

func (*MockRegister) EXPECT added in v1.1.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockRegister) GetHandlers added in v1.1.0

func (m *MockRegister) GetHandlers() map[string]http.Handler

GetHandlers mocks base method.

func (*MockRegister) GetWebhooks added in v1.1.0

func (m *MockRegister) GetWebhooks() ([]v1.MutatingWebhook, []v1.ValidatingWebhook)

GetWebhooks mocks base method.

type MockRegisterMockRecorder added in v1.1.0

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

MockRegisterMockRecorder is the mock recorder for MockRegister.

func (*MockRegisterMockRecorder) GetHandlers added in v1.1.0

func (mr *MockRegisterMockRecorder) GetHandlers() *gomock.Call

GetHandlers indicates an expected call of GetHandlers.

func (*MockRegisterMockRecorder) GetWebhooks added in v1.1.0

func (mr *MockRegisterMockRecorder) GetWebhooks() *gomock.Call

GetWebhooks indicates an expected call of GetWebhooks.

type Object added in v1.1.0

type Object interface {
	RuntimeObject() runtime.Object
}

Object is the interface for webhook objects

type Register added in v1.1.0

type Register interface {
	GetWebhooks() ([]admissionregv1.MutatingWebhook, []admissionregv1.ValidatingWebhook)
	GetHandlers() map[string]http.Handler
}

Register is the interface for webhook registers

type RegisterConfig added in v1.1.0

type RegisterConfig struct {
	*fctx.ControllerContext
	WebhookSvcNs   string
	WebhookSvcName string
	CaBundle       []byte
}

RegisterConfig is the configuration for webhook registers

type Server

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

Server is a construct to run generic HTTPS webhook servers.

func NewServer

func NewServer(name, namespace string, port int, cm *certificate.Manager, handlers map[string]http.HandlerFunc, onCertChange CertRotatedFunc) (*Server, error)

NewServer returns a new server based on the input. Run() must be called to start the server.

func (*Server) Run

func (s *Server) Run(ctx context.Context)

Run actually starts the server. It blocks until the passed in context is done.

type Validator added in v1.1.0

type Validator interface {
	Object
	ValidateCreate(obj interface{}) error
	ValidateUpdate(oldObj, obj interface{}) error
	ValidateDelete(obj interface{}) error
}

Validator is the interface for webhook validators

Directories

Path Synopsis
Package cluster contains webhook logic for the Cluster resource
Package cluster contains webhook logic for the Cluster resource
flb
secret
Package secret contains webhook logic for the FLB secret resource
Package secret contains webhook logic for the FLB secret resource
service
Package service contains webhook logic for the FLB service resource
Package service contains webhook logic for the FLB service resource
tls
Package tls contains webhook logic for the FLB TLS secret resource
Package tls contains webhook logic for the FLB TLS secret resource
Package gateway contains webhook logic for the Gateway resource
Package gateway contains webhook logic for the Gateway resource
Package gatewayclass contains webhook logic for the GatewayClass resource
Package gatewayclass contains webhook logic for the GatewayClass resource
Package globaltrafficpolicy contains webhook logic for the GlobalTrafficPolicy resource
Package globaltrafficpolicy contains webhook logic for the GlobalTrafficPolicy resource
Package grpcroute provides webhook for grpcroute
Package grpcroute provides webhook for grpcroute
Package httproute provides webhook for httproute
Package httproute provides webhook for httproute
Package ingress contains webhook logic for the Ingress resource
Package ingress contains webhook logic for the Ingress resource
Package namespacedingress contains the types for the NamespaceDingress webhook
Package namespacedingress contains the types for the NamespaceDingress webhook
Package serviceexport contains webhook logic for the ServiceExport resource
Package serviceexport contains webhook logic for the ServiceExport resource
Package serviceimport contains webhook logic for the ServiceImport resource
Package serviceimport contains webhook logic for the ServiceImport resource
Package tcproute provides webhook for tcproute
Package tcproute provides webhook for tcproute
Package tlsroute provides webhook for tlsroute
Package tlsroute provides webhook for tlsroute
Package udproute provides webhook for udproute
Package udproute provides webhook for udproute

Jump to

Keyboard shortcuts

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