limitranger

package
v0.18.2-0...-866293b Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2016 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Max

func Max(a int64, b int64) int64

Max returns the greater of its 2 arguments

func Min

func Min(a int64, b int64) int64

Min returns the lesser of its 2 arguments

func NewLimitRanger

func NewLimitRanger(client clientset.Interface, actions LimitRangerActions) (admission.Interface, error)

NewLimitRanger returns an object that enforces limits based on the supplied limit function

func PersistentVolumeClaimLimitFunc

func PersistentVolumeClaimLimitFunc(limitRange *api.LimitRange, pvc *api.PersistentVolumeClaim) error

PersistentVolumeClaimLimitFunc enforces storage limits for PVCs. Users request storage via pvc.Spec.Resources.Requests. Min/Max is enforced by an admin with LimitRange. Claims will not be modified with default values because storage is a required part of pvc.Spec. All storage enforced values *only* apply to pvc.Spec.Resources.Requests.

func PodLimitFunc

func PodLimitFunc(limitRange *api.LimitRange, pod *api.Pod) error

PodLimitFunc enforces resource requirements enumerated by the pod against the specified LimitRange. The pod may be modified to apply default resource requirements if not specified, and enumerated on the LimitRange

Types

type DefaultLimitRangerActions

type DefaultLimitRangerActions struct{}

DefaultLimitRangerActions is the default implementation of LimitRangerActions.

func (*DefaultLimitRangerActions) Limit

func (d *DefaultLimitRangerActions) Limit(limitRange *api.LimitRange, resourceName string, obj runtime.Object) error

Limit enforces resource requirements of incoming resources against enumerated constraints on the LimitRange. It may modify the incoming object to apply default resource requirements if not specified, and enumerated on the LimitRange

func (*DefaultLimitRangerActions) SupportsAttributes

func (d *DefaultLimitRangerActions) SupportsAttributes(a admission.Attributes) bool

SupportsAttributes ignores all calls that do not deal with pod resources or storage requests (PVCs). Also ignores any call that has a subresource defined.

func (*DefaultLimitRangerActions) SupportsLimit

func (d *DefaultLimitRangerActions) SupportsLimit(limitRange *api.LimitRange) bool

SupportsLimit always returns true.

type LimitRangerActions

type LimitRangerActions interface {
	// Limit is a pluggable function to enforce limits on the object.
	Limit(limitRange *api.LimitRange, kind string, obj runtime.Object) error
	// SupportsAttributes is a pluggable function to allow overridding what resources the limitranger
	// supports.
	SupportsAttributes(attr admission.Attributes) bool
	// SupportsLimit is a pluggable function to allow ignoring limits that should not be applied
	// for any reason.
	SupportsLimit(limitRange *api.LimitRange) bool
}

Jump to

Keyboard shortcuts

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