validator

package
v0.0.0-...-b22e9ac Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDeployment

func GetDeployment(req *adm.AdmissionRequest) (*apps.Deployment, bool)

Convenience function to extract a Deployment from the request, if it exists.

func NewResponse

func NewResponse(allowed bool, msg string) *adm.AdmissionResponse

Types

type CpuValidator

type CpuValidator struct {
	Max string
}

func NewCpuValidator

func NewCpuValidator() CpuValidator

func (CpuValidator) Validate

type MemValidator

type MemValidator struct {
	RequestRequired bool `split_words:"true"`
	LimitRequired   bool `split_words:"true"`
	Guaranteed      bool
}

func NewMemValidator

func NewMemValidator() MemValidator

func (MemValidator) Validate

type ReplicasValidator

type ReplicasValidator struct {
	Max int32
}

func NewReplicasValidator

func NewReplicasValidator() ReplicasValidator

func (ReplicasValidator) Validate

type Validator

type Validator interface {
	Validate(req *adm.AdmissionRequest) *adm.AdmissionResponse
}

func StaticValidator

func StaticValidator(allowed bool, msg string) Validator

Return a Validator that always returns the given response, ignoring any input. Useful for testing.

type ValidatorConfig

type ValidatorConfig struct {
	// contains filtered or unexported fields
}

func (*ValidatorConfig) Add

func (r *ValidatorConfig) Add(val Validator)

func (*ValidatorConfig) AddFunc

func (r *ValidatorConfig) AddFunc(f ValidatorFunc)

func (*ValidatorConfig) Validate

func (r *ValidatorConfig) Validate(request *adm.AdmissionRequest) *adm.AdmissionResponse

Call all registered Validators and stop with the first negative one.

type ValidatorFunc

type ValidatorFunc func(req *adm.AdmissionRequest) *adm.AdmissionResponse

func (ValidatorFunc) Validate

An Adapter to make sure we can use a ValidatorFunc as a Validator.

Jump to

Keyboard shortcuts

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