Documentation ¶
Index ¶
- Variables
- func GetAdmissionPluginConfigurationFor(pluginCfg apiserver.AdmissionPluginConfiguration, scheme *runtime.Scheme) (io.Reader, error)
- func NewChainHandler(handlers ...Interface) chainAdmissionHandler
- func NewForbidden(a Attributes, internalError error) error
- func NewNotFound(a Attributes) error
- func ValidateInitialization(plugin Interface) error
- type Attributes
- type ConfigProvider
- type Decorator
- type Factory
- type Handler
- type InitializationValidator
- type Interface
- type MutationInterface
- type Operation
- type PluginEnabledFunc
- type PluginInitializer
- type PluginInitializers
- type Plugins
- func (ps *Plugins) InitPlugin(name string, config io.Reader, pluginInitializer PluginInitializer) (Interface, error)
- func (ps *Plugins) NewFromPlugins(pluginNames []string, configProvider ConfigProvider, ...) (Interface, error)
- func (ps *Plugins) Register(name string, plugin Factory)
- func (ps *Plugins) Registered() []string
- type ReadyFunc
- type ValidationInterface
Constants ¶
This section is empty.
Variables ¶
var ( // PluginEnabledFn checks whether a plugin is enabled. By default, if you ask about it, it's enabled. PluginEnabledFn = func(name string, config io.Reader) bool { return true } )
All registered admission options.
Functions ¶
func GetAdmissionPluginConfigurationFor ¶
func GetAdmissionPluginConfigurationFor(pluginCfg apiserver.AdmissionPluginConfiguration, scheme *runtime.Scheme) (io.Reader, error)
GetAdmissionPluginConfigurationFor returns a reader that holds the admission plugin configuration.
func NewChainHandler ¶
func NewChainHandler(handlers ...Interface) chainAdmissionHandler
NewChainHandler creates a new chain handler from an array of handlers. Used for testing.
func NewForbidden ¶
func NewForbidden(a Attributes, internalError error) error
NewForbidden is a utility function to return a well-formatted admission control error response
func NewNotFound ¶
func NewNotFound(a Attributes) error
NewNotFound is a utility function to return a well-formatted admission control error response
func ValidateInitialization ¶ added in v1.9.0
ValidateInitialization will call the InitializationValidate function in each plugin if they implement the InitializationValidator interface.
Types ¶
type Attributes ¶
type Attributes interface { // GetName returns the name of the object as presented in the request. On a CREATE operation, the client // may omit name and rely on the server to generate the name. If that is the case, this method will return // the empty string GetName() string // GetNamespace is the namespace associated with the request (if any) GetNamespace() string // GetResource is the name of the resource being requested. This is not the kind. For example: pods GetResource() schema.GroupVersionResource // GetSubresource is the name of the subresource being requested. This is a different resource, scoped to the parent resource, but it may have a different kind. // For instance, /pods has the resource "pods" and the kind "Pod", while /pods/foo/status has the resource "pods", the sub resource "status", and the kind "Pod" // (because status operates on pods). The binding resource for a pod though may be /pods/foo/binding, which has resource "pods", subresource "binding", and kind "Binding". GetSubresource() string // GetOperation is the operation being performed GetOperation() Operation // GetObject is the object from the incoming request prior to default values being applied GetObject() runtime.Object // GetOldObject is the existing object. Only populated for UPDATE requests. GetOldObject() runtime.Object // GetKind is the type of object being manipulated. For example: Pod GetKind() schema.GroupVersionKind // GetUserInfo is information about the requesting user GetUserInfo() user.Info }
Attributes is an interface used by AdmissionController to get information about a request that is used to make an admission decision.
func NewAttributesRecord ¶
func NewAttributesRecord(object runtime.Object, oldObject runtime.Object, kind schema.GroupVersionKind, namespace, name string, resource schema.GroupVersionResource, subresource string, operation Operation, userInfo user.Info) Attributes
type ConfigProvider ¶
ConfigProvider provides a way to get configuration for an admission plugin based on its name
func ReadAdmissionConfiguration ¶
func ReadAdmissionConfiguration(pluginNames []string, configFilePath string, configScheme *runtime.Scheme) (ConfigProvider, error)
ReadAdmissionConfiguration reads the admission configuration at the specified path. It returns the loaded admission configuration if the input file aligns with the required syntax. If it does not align with the provided syntax, it returns a default configuration for the enumerated set of pluginNames whose config location references the specified configFilePath. It does this to preserve backward compatibility when admission control files were opaque. It returns an error if the file did not exist.
type Factory ¶
Factory is a function that returns an Interface for admission decisions. The config parameter provides an io.Reader handler to the factory in order to load specific configurations. If no configuration is provided the parameter is nil.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler is a base for admission control handlers that support a predefined set of operations
func NewHandler ¶
NewHandler creates a new base handler that handles the passed in operations
func (*Handler) SetReadyFunc ¶
SetReadyFunc allows late registration of a ReadyFunc to know if the handler is ready to process requests.
func (*Handler) WaitForReady ¶
WaitForReady will wait for the readyFunc (if registered) to return ready, and in case of timeout, will return false.
type InitializationValidator ¶ added in v1.9.0
type InitializationValidator interface {
ValidateInitialization() error
}
InitializationValidator holds ValidateInitialization functions, which are responsible for validation of initialized shared resources and should be implemented on admission plugins
type Interface ¶
type Interface interface { // Handles returns true if this admission controller can handle the given operation // where operation can be one of CREATE, UPDATE, DELETE, or CONNECT Handles(operation Operation) bool }
Interface is an abstract, pluggable interface for Admission Control decisions.
type MutationInterface ¶ added in v1.9.0
type MutationInterface interface { Interface // Admit makes an admission decision based on the request attributes Admit(a Attributes) (err error) }
type Operation ¶
type Operation string
Operation is the type of resource operation being checked for admission control
type PluginEnabledFunc ¶
PluginEnabledFunc is a function type that can provide an external check on whether an admission plugin may be enabled
type PluginInitializer ¶
type PluginInitializer interface {
Initialize(plugin Interface)
}
PluginInitializer is used for initialization of shareable resources between admission plugins. After initialization the resources have to be set separately
type PluginInitializers ¶
type PluginInitializers []PluginInitializer
func (PluginInitializers) Initialize ¶
func (pp PluginInitializers) Initialize(plugin Interface)
type Plugins ¶ added in v1.7.0
type Plugins struct { // ConfigScheme is used to parse the admission plugin config file. // It is exposed to act as a hook for extending server providing their own config. ConfigScheme *runtime.Scheme // contains filtered or unexported fields }
func NewPlugins ¶ added in v1.9.0
func NewPlugins() *Plugins
func (*Plugins) InitPlugin ¶ added in v1.7.0
func (ps *Plugins) InitPlugin(name string, config io.Reader, pluginInitializer PluginInitializer) (Interface, error)
InitPlugin creates an instance of the named interface.
func (*Plugins) NewFromPlugins ¶ added in v1.7.0
func (ps *Plugins) NewFromPlugins(pluginNames []string, configProvider ConfigProvider, pluginInitializer PluginInitializer, decorator Decorator) (Interface, error)
NewFromPlugins returns an admission.Interface that will enforce admission control decisions of all the given plugins.
func (*Plugins) Register ¶ added in v1.7.0
Register registers a plugin Factory by name. This is expected to happen during app startup.
func (*Plugins) Registered ¶ added in v1.7.0
Registered enumerates the names of all registered plugins.
type ReadyFunc ¶
type ReadyFunc func() bool
ReadyFunc is a function that returns true if the admission controller is ready to handle requests.
type ValidationInterface ¶ added in v1.9.0
type ValidationInterface interface { Interface // Validate makes an admission decision based on the request attributes. It is NOT allowed to mutate Validate(a Attributes) (err error) }
ValidationInterface is an abstract, pluggable interface for Admission Control decisions.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
plugin
|
|
webhook/config/apis/webhookadmission/install
Package install installs the experimental API group, making it available as an option to all of the API encoding/decoding machinery.
|
Package install installs the experimental API group, making it available as an option to all of the API encoding/decoding machinery. |
webhook/config/apis/webhookadmission/v1alpha1
Package v1alpha1 is the v1alpha1 version of the API.
|
Package v1alpha1 is the v1alpha1 version of the API. |
webhook/errors
Package errors contains utilities for admission webhook specific errors
|
Package errors contains utilities for admission webhook specific errors |
webhook/mutating
Package mutating delegates admission checks to dynamically configured mutating webhooks.
|
Package mutating delegates admission checks to dynamically configured mutating webhooks. |
webhook/namespace
Package namespace defines the utilities that are used by the webhook plugin to decide if a webhook should be applied to an object based on its namespace.
|
Package namespace defines the utilities that are used by the webhook plugin to decide if a webhook should be applied to an object based on its namespace. |
webhook/request
Package request creates admissionReview request based on admission attributes.
|
Package request creates admissionReview request based on admission attributes. |
webhook/testcerts
Package testcerts contains generated key pairs used by the unit tests of mutating and validating webhooks.
|
Package testcerts contains generated key pairs used by the unit tests of mutating and validating webhooks. |
webhook/validating
Package validating delegates admission checks to dynamically configured validating webhooks.
|
Package validating delegates admission checks to dynamically configured validating webhooks. |
webhook/versioned
Package versioned provides tools for making sure the objects sent to a webhook are in a version the webhook understands.
|
Package versioned provides tools for making sure the objects sent to a webhook are in a version the webhook understands. |