Documentation ¶
Index ¶
- type AdmissionType
- type Admitter
- type DefaultMutator
- func (v *DefaultMutator) Connect(request *Request, newObj runtime.Object) (Patch, error)
- func (v *DefaultMutator) Create(request *Request, newObj runtime.Object) (Patch, error)
- func (v *DefaultMutator) Delete(request *Request, oldObj runtime.Object) (Patch, error)
- func (v *DefaultMutator) Resource() Resource
- func (v *DefaultMutator) Update(request *Request, oldObj runtime.Object, newObj runtime.Object) (Patch, error)
- type DefaultValidator
- func (v *DefaultValidator) Connect(request *Request, newObj runtime.Object) error
- func (v *DefaultValidator) Create(request *Request, newObj runtime.Object) error
- func (v *DefaultValidator) Delete(request *Request, oldObj runtime.Object) error
- func (v *DefaultValidator) Resource() Resource
- func (v *DefaultValidator) Update(request *Request, oldObj runtime.Object, newObj runtime.Object) error
- type Handler
- type Mutator
- type Patch
- type PatchOp
- type PatchOperation
- type Request
- type Resource
- type Validator
- type ValidatorAdapter
- func (c *ValidatorAdapter) Connect(request *Request, newObj runtime.Object) (Patch, error)
- func (c *ValidatorAdapter) Create(request *Request, newObj runtime.Object) (Patch, error)
- func (c *ValidatorAdapter) Delete(request *Request, oldObj runtime.Object) (Patch, error)
- func (c *ValidatorAdapter) Resource() Resource
- func (c *ValidatorAdapter) Update(request *Request, oldObj runtime.Object, newObj runtime.Object) (Patch, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdmissionType ¶
type AdmissionType string
AdmissionType includes mutation and validation
var ( AdmissionTypeMutation AdmissionType = "mutation" AdmissionTypeValidation AdmissionType = "validation" )
type Admitter ¶
type Admitter interface { // Create checks if a CREATE operation is allowed. // Patches contains JSON patch operations to be applied on the API object received by the server. // If no error is returned, the operation is allowed. Create(request *Request, newObj runtime.Object) (Patch, error) // Update checks if a UPDATE operation is allowed. // Patches contains JSON patch operations to be applied on the API object received by the server. // If no error is returned, the operation is allowed. Update(request *Request, oldObj runtime.Object, newObj runtime.Object) (Patch, error) // Delete checks if a DELETE operation is allowed. // Patches contains JSON patch operations to be applied on the API object received by the server. // If no error is returned, the operation is allowed. Delete(request *Request, oldObj runtime.Object) (Patch, error) // Connect checks if a CONNECT operation is allowed. // Patches contains JSON patch operations to be applied on the API object received by the server. // If no error is returned, the operation is allowed. Connect(request *Request, newObj runtime.Object) (Patch, error) // Resource returns the resource that the admitter works on. Resource() Resource }
Admitter interface is used by AdmissionHandler to check if an operation is allowed.
func Validator2Admitter ¶
type DefaultMutator ¶
type DefaultMutator struct{}
DefaultMutator allows every supported operation and mutate nothing
func (*DefaultMutator) Resource ¶
func (v *DefaultMutator) Resource() Resource
type DefaultValidator ¶
type DefaultValidator struct{}
DefaultValidator allows every supported operation.
func (*DefaultValidator) Connect ¶
func (v *DefaultValidator) Connect(request *Request, newObj runtime.Object) error
func (*DefaultValidator) Create ¶
func (v *DefaultValidator) Create(request *Request, newObj runtime.Object) error
func (*DefaultValidator) Delete ¶
func (v *DefaultValidator) Delete(request *Request, oldObj runtime.Object) error
func (*DefaultValidator) Resource ¶
func (v *DefaultValidator) Resource() Resource
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler for the admitter webhook server
func NewHandler ¶
func NewHandler(admitter Admitter, admissionType AdmissionType, options *config.Options) *Handler
NewHandler returns a new admitter handler
func (*Handler) AddToWebhookRouter ¶
type Patch ¶
type Patch []PatchOp
Patch returned by the mutator JSON Patch operations to mutate input data. See https://jsonpatch.com/ for more information.
type PatchOp ¶
type PatchOp struct { Op PatchOperation `json:"op,required"` Path string `json:"path,required"` Value interface{} `json:"value,omitempty"` }
PatchOp is one patch operation
type PatchOperation ¶
type PatchOperation string
PatchOperation includes add, remove, replace, copy, move and test
const ( PatchOpAdd PatchOperation = "add" PatchOpRemove PatchOperation = "remove" PatchOpReplace PatchOperation = "replace" PatchOpCopy PatchOperation = "copy" PatchOpMove PatchOperation = "move" PatchOpTest PatchOperation = "test" )
type Request ¶
func NewRequest ¶
func (*Request) DecodeObjects ¶
func (*Request) IsFromController ¶
func (*Request) IsGarbageCollection ¶
type Resource ¶
type Resource struct { Names []string Scope admissionregv1.ScopeType APIGroup string APIVersion string ObjectType runtime.Object OperationTypes []admissionregv1.OperationType }
Resource used to build the webhook rules
type Validator ¶
type Validator interface { // Create checks if a CREATE operation is allowed. If no error is returned, the operation is allowed. Create(request *Request, newObj runtime.Object) error // Update checks if a UPDATE operation is allowed. If no error is returned, the operation is allowed. Update(request *Request, oldObj runtime.Object, newObj runtime.Object) error // Delete checks if a DELETE operation is allowed. If no error is returned, the operation is allowed. Delete(request *Request, oldObj runtime.Object) error // Connect checks if a CONNECT operation is allowed. If no error is returned, the operation is allowed. Connect(request *Request, newObj runtime.Object) error Resource() Resource }
Validator is a Mutator that doesn't modify received API objects.
type ValidatorAdapter ¶
type ValidatorAdapter struct {
// contains filtered or unexported fields
}
ValidatorAdapter adapts a Validator to an Admitter.
func (*ValidatorAdapter) Resource ¶
func (c *ValidatorAdapter) Resource() Resource