kubernetes: k8s.io/kubernetes/plugin/pkg/admission/limitranger Index | Files

package limitranger

import "k8s.io/kubernetes/plugin/pkg/admission/limitranger"

Index

Package Files

admission.go interfaces.go

Constants

const (

    // PluginName indicates name of admission plugin.
    PluginName = "LimitRanger"
)

func PersistentVolumeClaimValidateLimitFunc Uses

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

PersistentVolumeClaimValidateLimitFunc 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 PodMutateLimitFunc Uses

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

PodMutateLimitFunc sets 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

func PodValidateLimitFunc Uses

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

PodValidateLimitFunc enforces resource requirements enumerated by the pod against the specified LimitRange.

func Register Uses

func Register(plugins *admission.Plugins)

Register registers a plugin

type DefaultLimitRangerActions Uses

type DefaultLimitRangerActions struct{}

DefaultLimitRangerActions is the default implementation of LimitRangerActions.

func (*DefaultLimitRangerActions) MutateLimit Uses

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

MutateLimit 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 Uses

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 Uses

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

SupportsLimit always returns true.

func (*DefaultLimitRangerActions) ValidateLimit Uses

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

ValidateLimit verifies the resource requirements of incoming resources against enumerated constraints on the LimitRange are valid

type LimitRanger Uses

type LimitRanger struct {
    *admission.Handler
    // contains filtered or unexported fields
}

LimitRanger enforces usage limits on a per resource basis in the namespace

func NewLimitRanger Uses

func NewLimitRanger(actions LimitRangerActions) (*LimitRanger, error)

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

func (*LimitRanger) Admit Uses

func (l *LimitRanger) Admit(ctx context.Context, a admission.Attributes, o admission.ObjectInterfaces) (err error)

Admit admits resources into cluster that do not violate any defined LimitRange in the namespace

func (*LimitRanger) GetLimitRanges Uses

func (l *LimitRanger) GetLimitRanges(a admission.Attributes) ([]*corev1.LimitRange, error)

GetLimitRanges returns a LimitRange object with the items held in the indexer if available, or do alive lookup of the value.

func (*LimitRanger) SetExternalKubeClientSet Uses

func (l *LimitRanger) SetExternalKubeClientSet(client kubernetes.Interface)

SetExternalKubeClientSet registers the client into LimitRanger

func (*LimitRanger) SetExternalKubeInformerFactory Uses

func (l *LimitRanger) SetExternalKubeInformerFactory(f informers.SharedInformerFactory)

SetExternalKubeInformerFactory registers an informer factory into the LimitRanger

func (*LimitRanger) Validate Uses

func (l *LimitRanger) Validate(ctx context.Context, a admission.Attributes, o admission.ObjectInterfaces) (err error)

Validate admits resources into cluster that do not violate any defined LimitRange in the namespace

func (*LimitRanger) ValidateInitialization Uses

func (l *LimitRanger) ValidateInitialization() error

ValidateInitialization verifies the LimitRanger object has been properly initialized

type LimitRangerActions Uses

type LimitRangerActions interface {
    // MutateLimit is a pluggable function to set limits on the object.
    MutateLimit(limitRange *corev1.LimitRange, kind string, obj runtime.Object) error
    // ValidateLimits is a pluggable function to enforce limits on the object.
    ValidateLimit(limitRange *corev1.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 *corev1.LimitRange) bool
}

LimitRangerActions is an interface defining actions to be carried over ranges to identify and manipulate their limits

Package limitranger imports 20 packages (graph) and is imported by 73 packages. Updated 2019-11-12. Refresh now. Tools for package owners.