Documentation ¶
Index ¶
- Constants
- type AdmissionHandler
- type Admitter
- type DefaultMutator
- func (v *DefaultMutator) Connect(_ *Request, _ runtime.Object) (PatchOps, error)
- func (v *DefaultMutator) Create(_ *Request, _ runtime.Object) (PatchOps, error)
- func (v *DefaultMutator) Delete(_ *Request, _ runtime.Object) (PatchOps, error)
- func (v *DefaultMutator) Update(_ *Request, _ runtime.Object, _ runtime.Object) (PatchOps, error)
- type DefaultValidator
- type Mutator
- type PatchOps
- type Request
- type Resource
- type Validator
- type ValidatorAdapter
- func (c *ValidatorAdapter) Connect(request *Request, newObj runtime.Object) (PatchOps, error)
- func (c *ValidatorAdapter) Create(request *Request, newObj runtime.Object) (PatchOps, error)
- func (c *ValidatorAdapter) Delete(request *Request, oldObj runtime.Object) (PatchOps, error)
- func (c *ValidatorAdapter) Resource() Resource
- func (c *ValidatorAdapter) Update(request *Request, oldObj runtime.Object, newObj runtime.Object) (PatchOps, error)
Constants ¶
View Source
const ( AdmissionTypeMutation = "mutation" AdmissionTypeValidation = "validation" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdmissionHandler ¶
type AdmissionHandler struct {
// contains filtered or unexported fields
}
func NewAdmissionHandler ¶
func NewAdmissionHandler(admitter Admitter, admissionType string, options *config.Options) *AdmissionHandler
type Admitter ¶
type Admitter interface { // Create checks if a CREATE operation is allowed. // PatchOps 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) (PatchOps, error) // Update checks if a UPDATE operation is allowed. // PatchOps 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) (PatchOps, error) // Delete checks if a DELETE operation is allowed. // PatchOps 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) (PatchOps, error) // Connect checks if a CONNECT operation is allowed. // PatchOps 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) (PatchOps, error) // Resource returns the resource that the admitter works on. Resource() Resource }
A Admitter interface is used by AdmissionHandler to check if a operation is allowed.
type DefaultMutator ¶
type DefaultMutator struct { }
DefaultMutator allows every supported operation and mutate nothing
type DefaultValidator ¶
type DefaultValidator struct { }
DefaultValidator allows every supported operation.
func (*DefaultValidator) Connect ¶
func (v *DefaultValidator) Connect(_ *Request, _ runtime.Object) error
func (*DefaultValidator) Create ¶
func (v *DefaultValidator) Create(_ *Request, _ runtime.Object) error
type PatchOps ¶
type PatchOps []string
JSON Patch operations to mutate input data. See https://jsonpatch.com/ for more information.
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 }
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
Click to show internal directories.
Click to hide internal directories.