Documentation ¶
Overview ¶
Package webhook implements utility routines related to Kubernetes' admission webhooks.
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 GetAdmissionRequestBody ¶
GetAdmissionRequestBody returns the body of the admission request
func RecordAdmissionMetrics ¶
func RecordAdmissionMetrics(req *admissionv1.AdmissionRequest, resp *admissionv1.AdmissionResponse)
RecordAdmissionMetrics records metrics for the given admission response
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 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.
Click to show internal directories.
Click to hide internal directories.