core

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewQuotaNode

func NewQuotaNode(quotaName string, sharedWeight, request, min int64, allowLentResource bool) *quotaNode

func NewQuotaTree

func NewQuotaTree() *quotaTree

Types

type GroupQuotaManager

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

func NewGroupQuotaManager

func NewGroupQuotaManager(systemGroupMax, defaultGroupMax v1.ResourceList) *GroupQuotaManager

func (*GroupQuotaManager) GetAllQuotaNames

func (gqm *GroupQuotaManager) GetAllQuotaNames() map[string]struct{}

func (*GroupQuotaManager) GetClusterTotalResource

func (gqm *GroupQuotaManager) GetClusterTotalResource() v1.ResourceList

func (*GroupQuotaManager) GetQuotaInfoByName

func (gqm *GroupQuotaManager) GetQuotaInfoByName(quotaName string) *QuotaInfo

func (*GroupQuotaManager) GetQuotaInformationForSyncHandler added in v1.0.0

func (gqm *GroupQuotaManager) GetQuotaInformationForSyncHandler(quotaName string) (used, request, runtime v1.ResourceList, err error)

func (*GroupQuotaManager) GetQuotaSummaries added in v1.0.0

func (gqm *GroupQuotaManager) GetQuotaSummaries() map[string]*QuotaInfoSummary

func (*GroupQuotaManager) GetQuotaSummary

func (gqm *GroupQuotaManager) GetQuotaSummary(quotaName string) (*QuotaInfoSummary, bool)

func (*GroupQuotaManager) MigratePod added in v1.0.0

func (gqm *GroupQuotaManager) MigratePod(pod *v1.Pod, out, in string)

func (*GroupQuotaManager) OnPodAdd added in v1.0.0

func (gqm *GroupQuotaManager) OnPodAdd(quotaName string, pod *v1.Pod)

func (*GroupQuotaManager) OnPodDelete added in v1.0.0

func (gqm *GroupQuotaManager) OnPodDelete(quotaName string, pod *v1.Pod)

func (*GroupQuotaManager) OnPodUpdate added in v1.0.0

func (gqm *GroupQuotaManager) OnPodUpdate(newQuotaName, oldQuotaName string, newPod, oldPod *v1.Pod)

func (*GroupQuotaManager) RefreshRuntime

func (gqm *GroupQuotaManager) RefreshRuntime(quotaName string) v1.ResourceList

func (*GroupQuotaManager) RefreshRuntimeNoLock

func (gqm *GroupQuotaManager) RefreshRuntimeNoLock(quotaName string) v1.ResourceList

func (*GroupQuotaManager) ReservePod added in v1.0.0

func (gqm *GroupQuotaManager) ReservePod(quotaName string, p *v1.Pod)

func (*GroupQuotaManager) UnreservePod added in v1.0.0

func (gqm *GroupQuotaManager) UnreservePod(quotaName string, p *v1.Pod)

func (*GroupQuotaManager) UpdateClusterTotalResource

func (gqm *GroupQuotaManager) UpdateClusterTotalResource(deltaRes v1.ResourceList)

func (*GroupQuotaManager) UpdatePodIsAssigned

func (gqm *GroupQuotaManager) UpdatePodIsAssigned(quotaName string, pod *v1.Pod, isAssigned bool) error

func (*GroupQuotaManager) UpdateQuota

func (gqm *GroupQuotaManager) UpdateQuota(quota *v1alpha1.ElasticQuota, isDelete bool) error

type PodInfo

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

func NewPodInfo

func NewPodInfo(pod *v1.Pod) *PodInfo

type QuotaCalculateInfo

type QuotaCalculateInfo struct {
	// The semantics of "max" is the quota group's upper limit of resources.
	Max v1.ResourceList
	// The semantics of "min" is the quota group's guaranteed resources, if quota group's "request" less than or
	// equal to "min", the quota group can obtain equivalent resources to the "request"
	Min v1.ResourceList
	// If Child's sumMin is larger than totalResource, the value of Min should be scaled in equal proportion
	//to ensure the correctness and fairness of min
	AutoScaleMin v1.ResourceList
	// All assigned pods used
	Used v1.ResourceList
	// All pods request
	Request v1.ResourceList
	// SharedWeight determines the ability of quota groups to compete for shared resources
	SharedWeight v1.ResourceList
	// Runtime is the current actual resource that can be used by the quota group
	Runtime v1.ResourceList
}

type QuotaInfo

type QuotaInfo struct {
	// Name
	Name string
	// Quota's ParentName
	ParentName string
	// IsParent quota group
	IsParent bool
	// If runtimeVersion not equal to quotaTree runtimeVersion, means runtime has been updated.
	RuntimeVersion int64
	// Allow lent resource to other quota group
	AllowLentResource bool
	CalculateInfo     QuotaCalculateInfo
	PodCache          map[string]*PodInfo
	// contains filtered or unexported fields
}

func NewQuotaInfo

func NewQuotaInfo(isParent, allowLentResource bool, name, parentName string) *QuotaInfo

func NewQuotaInfoFromQuota

func NewQuotaInfoFromQuota(quota *v1alpha1.ElasticQuota) *QuotaInfo

func (*QuotaInfo) DeepCopy

func (qi *QuotaInfo) DeepCopy() *QuotaInfo

func (*QuotaInfo) GetPodCache

func (qi *QuotaInfo) GetPodCache() map[string]*v1.Pod

func (*QuotaInfo) GetPodIsAssigned

func (qi *QuotaInfo) GetPodIsAssigned(pod *v1.Pod) bool

func (*QuotaInfo) GetQuotaSummary

func (qi *QuotaInfo) GetQuotaSummary() *QuotaInfoSummary

func (*QuotaInfo) GetRequest

func (qi *QuotaInfo) GetRequest() v1.ResourceList

func (*QuotaInfo) GetRuntime

func (qi *QuotaInfo) GetRuntime() v1.ResourceList

func (*QuotaInfo) GetUsed

func (qi *QuotaInfo) GetUsed() v1.ResourceList

func (*QuotaInfo) Lock

func (qi *QuotaInfo) Lock()

func (*QuotaInfo) UnLock

func (qi *QuotaInfo) UnLock()

func (*QuotaInfo) UpdatePodIsAssigned

func (qi *QuotaInfo) UpdatePodIsAssigned(podName string, isAssigned bool) error

type QuotaInfoSummary

type QuotaInfoSummary struct {
	Name              string `json:"name"`
	ParentName        string `json:"parentName"`
	IsParent          bool   `json:"isParent"`
	RuntimeVersion    int64  `json:"runtimeVersion"`
	AllowLentResource bool   `json:"allowLentResource"`

	Max          v1.ResourceList `json:"max"`
	Min          v1.ResourceList `json:"min"`
	AutoScaleMin v1.ResourceList `json:"autoScaleMin"`
	Used         v1.ResourceList `json:"used"`
	Request      v1.ResourceList `json:"request"`
	SharedWeight v1.ResourceList `json:"sharedWeight"`
	Runtime      v1.ResourceList `json:"runtime"`

	PodCache map[string]*SimplePodInfo `json:"podCache"`
}

func NewQuotaInfoSummary

func NewQuotaInfoSummary() *QuotaInfoSummary

type QuotaTopoNode

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

QuotaTopoNode only contains the topology of the parent/child relationship, helps to reconstruct quotaTree from the rootQuotaGroup to all the leafQuotaNode.

func NewQuotaTopoNode

func NewQuotaTopoNode(quotaInfo *QuotaInfo) *QuotaTopoNode

type RuntimeQuotaCalculator

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

RuntimeQuotaCalculator helps to calculate the childGroups' all resource dimensions' runtimeQuota of the corresponding quotaInfo(treeName)

func NewRuntimeQuotaCalculator

func NewRuntimeQuotaCalculator(treeName string) *RuntimeQuotaCalculator

type ScaleMinQuotaManager

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

ScaleMinQuotaManager The child nodes under each node will be divided into two categories, one allows scaling min quota, and the other does not allow. When our total resources are insufficient, the min quota of child nodes will be proportionally reduced. In order to calculate the scaling of the min quota, we will count the sum of the min quota of the child nodes of each node in advance. The quota of the child nodes that allow scaling is stored in enableScaleSubsSumMinQuotaMap, and the quota of child nodes that do not allow scaling is stored in disableScaleSubsSumMinQuotaMap

func NewScaleMinQuotaManager

func NewScaleMinQuotaManager() *ScaleMinQuotaManager

type SimplePodInfo

type SimplePodInfo struct {
	IsAssigned bool            `json:"isAssigned"`
	Resource   v1.ResourceList `json:"resource"`
}

Jump to

Keyboard shortcuts

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