Documentation ¶
Overview ¶
Package webhook is a generated GoMock package.
Package webhook implements utility routines related to Kubernetes' admission webhook.
Index ¶
- Variables
- func AdmissionError(err error) *admissionv1.AdmissionResponse
- func DefaultingWebhookFor(scheme *runtime.Scheme, defaulter Defaulter) *admission.Webhook
- func GetAdmissionRequestBody(w http.ResponseWriter, req *http.Request) ([]byte, error)
- func GetListenerIfHasMatchingPort(port gwv1.PortNumber, listeners []gwv1.Listener) *gwv1.Listener
- func IsValidHostname(hostname string) error
- func IsValidIPOrCIDR(value string) []string
- func RecordAdmissionMetrics(req *admissionv1.AdmissionRequest, resp *admissionv1.AdmissionResponse)
- func ValidateParentRefs(refs []gwv1.ParentReference) field.ErrorList
- func ValidateRouteHostnames(hostnames []gwv1.Hostname) field.ErrorList
- func ValidatingWebhookFor(scheme *runtime.Scheme, validator Validator) *admission.Webhook
- type CertRotatedFunc
- type Defaulter
- type MockRegister
- type MockRegisterMockRecorder
- type Object
- type Register
- type RegisterConfig
- type Server
- type Validator
Constants ¶
This section is empty.
Variables ¶
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
DefaultingWebhookFor returns a webhook that defaults the given object.
func GetAdmissionRequestBody ¶
GetAdmissionRequestBody returns the body of the admission request
func GetListenerIfHasMatchingPort ¶ added in v1.2.0
func IsValidHostname ¶ added in v1.1.0
IsValidHostname validates the hostname of gateway route resource
func IsValidIPOrCIDR ¶ added in v1.2.0
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 []gwv1.ParentReference) field.ErrorList
ValidateParentRefs validates the parent refs of gateway route resource
func ValidateRouteHostnames ¶ added in v1.1.0
ValidateRouteHostnames validates the hostnames of gateway route resource
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
func (m *MockRegister) EXPECT() *MockRegisterMockRecorder
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 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.
Source Files ¶
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 |
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 |