Documentation
¶
Overview ¶
Package admission provides shared admission-webhook helpers: decode/dispatch/encode, allow/deny builders, and JSON patch utilities.
Index ¶
- Constants
- func Allow() *admissionv1.AdmissionResponse
- func Decode(r *http.Request, maxBytes int64) (*admissionv1.AdmissionReview, error)
- func Deny(msg string) *admissionv1.AdmissionResponse
- func EscapeJSONPointer(s string) string
- func MarshalPatch(ops []JSONPatchOp) ([]byte, error)
- func Serve(w http.ResponseWriter, r *http.Request, maxBytes int64, handler Handler)
- type Handler
- type JSONPatchOp
Constants ¶
View Source
const DefaultMaxBody int64 = 10 << 20
DefaultMaxBody is the request-body ceiling Serve applies when the caller passes 0.
Variables ¶
This section is empty.
Functions ¶
func Allow ¶
func Allow() *admissionv1.AdmissionResponse
Allow returns an AdmissionResponse that permits the request.
func Decode ¶
func Decode(r *http.Request, maxBytes int64) (*admissionv1.AdmissionReview, error)
Decode parses an AdmissionReview from r, using DefaultMaxBody when maxBytes <= 0.
func Deny ¶
func Deny(msg string) *admissionv1.AdmissionResponse
Deny returns a forbidden AdmissionResponse with the given message.
func EscapeJSONPointer ¶
EscapeJSONPointer escapes ~ and / per RFC 6901 for use in patch paths.
func MarshalPatch ¶
func MarshalPatch(ops []JSONPatchOp) ([]byte, error)
MarshalPatch encodes patch ops as JSON for AdmissionResponse.Patch.
Types ¶
type Handler ¶
type Handler func(ctx context.Context, review *admissionv1.AdmissionReview) *admissionv1.AdmissionResponse
Handler is the admission callback. A nil return is treated as Allow().
Click to show internal directories.
Click to hide internal directories.