admission

package
v0.19.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 9, 2015 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPlugins

func GetPlugins() []string

GetPlugins enumerates the

func NewForbidden

func NewForbidden(a Attributes, internalError error) error

NewForbidden is a utility function to return a well-formatted admission control error response

func RegisterPlugin

func RegisterPlugin(name string, plugin Factory)

RegisterPlugin registers a plugin Factory by name. This is expected to happen during app startup.

Types

type Attributes

type Attributes interface {
	GetNamespace() string
	GetResource() string
	GetOperation() Operation
	GetObject() runtime.Object
	GetKind() string
	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, kind, namespace, resource string, operation Operation, userInfo user.Info) Attributes

type Factory

type Factory func(client client.Interface, config io.Reader) (Interface, error)

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

func NewHandler(ops ...Operation) *Handler

NewHandler creates a new base handler that handles the passed in operations

func (*Handler) Handles

func (h *Handler) Handles(operation Operation) bool

Handles returns true for methods that this handler supports

type Interface

type Interface interface {
	// Admit makes an admission decision based on the request attributes
	Admit(a Attributes) (err error)

	// 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.

func GetPlugin

func GetPlugin(name string, client client.Interface, config io.Reader) (Interface, error)

GetPlugin creates an instance of the named plugin, or nil if the name is not known. The error return is only used if the named provider was known but failed to initialize. The config parameter specifies the io.Reader handler of the configuration file for the cloud provider, or nil for no configuration.

func InitPlugin

func InitPlugin(name string, client client.Interface, configFilePath string) Interface

InitPlugin creates an instance of the named interface.

func NewChainHandler

func NewChainHandler(handlers ...Interface) Interface

NewChainHandler creates a new chain handler from an array of handlers. Used for testing.

func NewFromPlugins

func NewFromPlugins(client client.Interface, pluginNames []string, configFilePath string) Interface

NewFromPlugins returns an admission.Interface that will enforce admission control decisions of all the given plugins.

type Operation

type Operation string

Operation is the type of resource operation being checked for admission control

const (
	Create  Operation = "CREATE"
	Update  Operation = "UPDATE"
	Delete  Operation = "DELETE"
	Connect Operation = "CONNECT"
)

Operation constants

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL