Documentation ¶
Overview ¶
Package webhook contains resources for the ValidatingWebhookConfiguration. Referenced: https://github.com/kubernetes/kubernetes/blob/v1.15.0/test/images/webhook
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidContentType ... ErrInvalidContentType = errors.New("webhook: invalid content type; expected application/json") // ErrMissingContentType ... ErrMissingContentType = errors.New("webhook: missing content-type header") // ErrObjectNotFound ... ErrObjectNotFound = errors.New("webhook: request did not include object") // ErrUnexpectedResource ... ErrUnexpectedResource = errors.New("webhook: expected pod resource") // ErrInvalidAdmission ... ErrInvalidAdmission = errors.New("webhook: admission request was nil") // ErrInvalidContainer ... ErrInvalidContainer = errors.New("webhook: container is not from ecr") )
var ErrMissingFailure = errors.New("webhook: reached invalidate state, no failure reaon found")
ErrMissingFailure ...
Functions ¶
func DeserializeReview ¶
func DeserializeReview(body string, out *v1beta1.AdmissionReview) error
DeserializeReview is a helper for deserializing a JSON encoded string into a Kubernetes Admission Review.
func InCriticalNamespace ¶
InCriticalNamespace checks that the request was for a resource that is being deployed into a cricial name space; e.g. kube-system.
Types ¶
type Request ¶
type Request struct {
Admission *v1beta1.AdmissionRequest
}
Request encapsulates the AdmissionRequest from the AdmissionReview proxied to the Lambda function.
func NewRequestFromEvent ¶
func NewRequestFromEvent(event events.APIGatewayProxyRequest) (*Request, error)
NewRequestFromEvent creates a Request from the APIGatewayProxyRequest.
type Response ¶
type Response struct {
Admission *v1beta1.AdmissionResponse
}
Response encapsulates the AdmissionResponse sent to API Gateway
func NewResponseFromRequest ¶
NewResponseFromRequest creates a Response from a Request.
func (*Response) FailValidation ¶
FailValidation populates the AdmissionResponse with the failure contents (message and error) and returns the AdmissionReview JSON body response for API Gateway.
func (*Response) PassValidation ¶
func (r *Response) PassValidation() *v1beta1.AdmissionReview
PassValidation populates the AdmissionResponse with the pass contents (message) and returns the AdmissionReview JSON response for API Gateway.