capacityscheduling

package
v0.0.1-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Name is the name of the plugin used in Registry and configurations.
	Name = "CapacityScheduling"

	ElasticQuotaSnapshotKey = "ElasticQuotaSnapshot"
)

Variables

This section is empty.

Functions

func New

func New(obj runtime.Object, handle framework.Handle) (framework.Plugin, error)

New initializes a new plugin and returns it.

Types

type CapacityScheduling

type CapacityScheduling struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

CapacityScheduling is a plugin that implements the mechanism of capacity scheduling.

func (*CapacityScheduling) AddPod

func (c *CapacityScheduling) AddPod(ctx context.Context, cycleState *framework.CycleState, podToSchedule *v1.Pod, podToAdd *framework.PodInfo, nodeInfo *framework.NodeInfo) *framework.Status

AddPod from pre-computed data in cycleState.

func (*CapacityScheduling) EventsToRegister

func (c *CapacityScheduling) EventsToRegister() []framework.ClusterEvent

func (*CapacityScheduling) Name

func (c *CapacityScheduling) Name() string

Name returns name of the plugin. It is used in logs, etc.

func (*CapacityScheduling) PostFilter

func (*CapacityScheduling) PreFilter

PreFilter performs the following validations. 1. Check if the (pod.request + eq.allocated) is less than eq.max. 2. Check if the sum(eq's usage) > sum(eq's min).

func (*CapacityScheduling) PreFilterExtensions

func (c *CapacityScheduling) PreFilterExtensions() framework.PreFilterExtensions

PreFilterExtensions returns prefilter extensions, pod add and remove.

func (*CapacityScheduling) RemovePod

func (c *CapacityScheduling) RemovePod(ctx context.Context, cycleState *framework.CycleState, podToSchedule *v1.Pod, podToRemove *framework.PodInfo, nodeInfo *framework.NodeInfo) *framework.Status

RemovePod from pre-computed data in cycleState.

func (*CapacityScheduling) Reserve

func (c *CapacityScheduling) Reserve(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodeName string) *framework.Status

func (*CapacityScheduling) Unreserve

func (c *CapacityScheduling) Unreserve(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodeName string)

type ElasticQuotaInfo

type ElasticQuotaInfo struct {
	// ResourceName is the name of the resource (ElasticQuota or CompositeElasticQuota)
	// associated to the ElasticQuotaInfo
	ResourceName string
	// ResourceNamespace is the namespace to which the resource (ElasticQuota or CompositeElasticQuota)
	// associated to the ElasticQuotaInfo belongs to
	ResourceNamespace string

	Namespaces sets.String

	Min         *framework.Resource
	Max         *framework.Resource
	Used        *framework.Resource
	MaxEnforced bool
	// contains filtered or unexported fields
}

ElasticQuotaInfo wraps ElasticQuotas and CompositeElasticQuotas adding additional information and utility methods.

type ElasticQuotaInfoInformer

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

ElasticQuotaInfoInformer is a wrapper around ElasticQuota and CompositeElasticQuota informers that exposes their respective types as ElasticQuotaInfo

func NewElasticQuotaInfoInformer

func NewElasticQuotaInfoInformer(kubeConfig *restclient.Config, resourceCalculator resource.Calculator) (*ElasticQuotaInfoInformer, error)

func (ElasticQuotaInfoInformer) AddEventHandler

func (i ElasticQuotaInfoInformer) AddEventHandler(handler cache.ResourceEventHandler)

AddEventHandler adds an event handler that receives events for both CompositeElasticQuota and ElasticQuota resources.

The handler always receives ElasticQuotaInfo objects, no matters if the event was generated by an ElasticQuota or a CompositeElasticQuota resource.

Events for ElasticQuota resources are sent only if the namespace to which the ElasticQuota belongs to is not subject to any CompositeElasticQuota. In such a case, the CompositeElasticQuota takes precedence and only its events are sent to the handler, while ElasticQuota events are ignored.

func (ElasticQuotaInfoInformer) GetAssociatedCompositeElasticQuota

func (i ElasticQuotaInfoInformer) GetAssociatedCompositeElasticQuota(namespace string) (*ElasticQuotaInfo, error)

GetAssociatedCompositeElasticQuota returns, if present, the CompositeElasticQuota to which the namespace provided as argument is subject to

func (ElasticQuotaInfoInformer) GetAssociatedElasticQuota

func (i ElasticQuotaInfoInformer) GetAssociatedElasticQuota(namespace string) (*ElasticQuotaInfo, error)

GetAssociatedElasticQuota returns, if present, the ElasticQuotaInfo that sets the quota limits on the namespace provided as argument.

If namespace is not associated with any ElasticQuota then nil is returned.

func (ElasticQuotaInfoInformer) HasSynced

func (i ElasticQuotaInfoInformer) HasSynced() bool

func (ElasticQuotaInfoInformer) Start

func (i ElasticQuotaInfoInformer) Start(stopCh <-chan struct{})

type ElasticQuotaInfos

type ElasticQuotaInfos map[string]*ElasticQuotaInfo

ElasticQuotaInfos associates namespaces with the respective ElasticQuotaInfo that defines its quota

func NewElasticQuotaInfos

func NewElasticQuotaInfos() ElasticQuotaInfos

func (ElasticQuotaInfos) Add

func (e ElasticQuotaInfos) Add(eqInfo *ElasticQuotaInfo)

func (ElasticQuotaInfos) AggregatedUsedOverMinWith

func (e ElasticQuotaInfos) AggregatedUsedOverMinWith(podRequest framework.Resource) bool

func (ElasticQuotaInfos) Delete

func (e ElasticQuotaInfos) Delete(eqInfo *ElasticQuotaInfo)

func (ElasticQuotaInfos) GetGuaranteedOverquotas

func (e ElasticQuotaInfos) GetGuaranteedOverquotas(elasticQuota string) (*framework.Resource, error)

func (ElasticQuotaInfos) Update

func (e ElasticQuotaInfos) Update(oldEqInfo, newEqInfo *ElasticQuotaInfo)

type ElasticQuotaSnapshotState

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

ElasticQuotaSnapshotState stores the snapshot of elasticQuotas.

func (*ElasticQuotaSnapshotState) Clone

Clone the ElasticQuotaSnapshot state.

type PreFilterState

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

PreFilterState computed at PreFilter and used at PostFilter or Reserve.

func (*PreFilterState) Clone

func (s *PreFilterState) Clone() framework.StateData

Clone the preFilter state.

Jump to

Keyboard shortcuts

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