Documentation ¶
Index ¶
- func NewQuotaNode(quotaName string, sharedWeight, request, min, guarantee int64, ...) *quotaNode
- func NewQuotaTree() *quotaTree
- func PodRequestsAndLimits(pod *corev1.Pod) (reqs, limits corev1.ResourceList)
- type GroupQuotaManager
- func (gqm *GroupQuotaManager) GetAllQuotaNames() map[string]struct{}
- func (gqm *GroupQuotaManager) GetClusterTotalResource() v1.ResourceList
- func (gqm *GroupQuotaManager) GetQuotaInfoByName(quotaName string) *QuotaInfo
- func (gqm *GroupQuotaManager) GetQuotaSummaries(includePods bool) map[string]*QuotaInfoSummary
- func (gqm *GroupQuotaManager) GetQuotaSummary(quotaName string, includePods bool) (*QuotaInfoSummary, bool)
- func (gqm *GroupQuotaManager) GetTreeID() string
- func (gqm *GroupQuotaManager) MigratePod(pod *v1.Pod, out, in string)
- func (gqm *GroupQuotaManager) OnNodeAdd(node *v1.Node)
- func (gqm *GroupQuotaManager) OnNodeDelete(node *v1.Node)
- func (gqm *GroupQuotaManager) OnNodeUpdate(oldNode, newNode *v1.Node)
- func (gqm *GroupQuotaManager) OnPodAdd(quotaName string, pod *v1.Pod)
- func (gqm *GroupQuotaManager) OnPodDelete(quotaName string, pod *v1.Pod)
- func (gqm *GroupQuotaManager) OnPodUpdate(newQuotaName, oldQuotaName string, newPod, oldPod *v1.Pod)
- func (gqm *GroupQuotaManager) RefreshRuntime(quotaName string) v1.ResourceList
- func (gqm *GroupQuotaManager) ReservePod(quotaName string, p *v1.Pod)
- func (gqm *GroupQuotaManager) SetTotalResourceForTree(total v1.ResourceList) v1.ResourceList
- func (gqm *GroupQuotaManager) UnreservePod(quotaName string, p *v1.Pod)
- func (gqm *GroupQuotaManager) UpdateClusterTotalResource(deltaRes v1.ResourceList)
- func (gqm *GroupQuotaManager) UpdatePodIsAssigned(quotaName string, pod *v1.Pod, isAssigned bool) error
- func (gqm *GroupQuotaManager) UpdateQuota(quota *v1alpha1.ElasticQuota, isDelete bool) error
- type PodInfo
- type QuotaCalculateInfo
- type QuotaInfo
- func (qi *QuotaInfo) CheckPodIsAssigned(pod *v1.Pod) bool
- func (qi *QuotaInfo) DeepCopy() *QuotaInfo
- func (qi *QuotaInfo) GetAllocated() v1.ResourceList
- func (qi *QuotaInfo) GetChildRequest() v1.ResourceList
- func (qi *QuotaInfo) GetGuaranteed() v1.ResourceList
- func (qi *QuotaInfo) GetMax() v1.ResourceList
- func (qi *QuotaInfo) GetMin() v1.ResourceList
- func (qi *QuotaInfo) GetNonPreemptibleRequest() v1.ResourceList
- func (qi *QuotaInfo) GetNonPreemptibleUsed() v1.ResourceList
- func (qi *QuotaInfo) GetPodCache() map[string]*v1.Pod
- func (qi *QuotaInfo) GetPodThatIsAssigned() []*v1.Pod
- func (qi *QuotaInfo) GetQuotaSummary(treeID string, includePods bool) *QuotaInfoSummary
- func (qi *QuotaInfo) GetRequest() v1.ResourceList
- func (qi *QuotaInfo) GetRuntime() v1.ResourceList
- func (qi *QuotaInfo) GetUsed() v1.ResourceList
- func (qi *QuotaInfo) IsPodExist(pod *v1.Pod) bool
- func (qi *QuotaInfo) Lock()
- func (qi *QuotaInfo) UnLock()
- func (qi *QuotaInfo) UpdatePodIsAssigned(pod *v1.Pod, isAssigned bool) error
- type QuotaInfoSummary
- type QuotaTopoNode
- type RuntimeQuotaCalculator
- type ScaleMinQuotaManager
- type SimplePodInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewQuotaNode ¶
func NewQuotaTree ¶
func NewQuotaTree() *quotaTree
func PodRequestsAndLimits ¶ added in v1.4.0
func PodRequestsAndLimits(pod *corev1.Pod) (reqs, limits corev1.ResourceList)
Types ¶
type GroupQuotaManager ¶
type GroupQuotaManager struct {
// contains filtered or unexported fields
}
func NewGroupQuotaManager ¶
func NewGroupQuotaManager(treeID string, 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) GetQuotaSummaries ¶ added in v1.0.0
func (gqm *GroupQuotaManager) GetQuotaSummaries(includePods bool) map[string]*QuotaInfoSummary
func (*GroupQuotaManager) GetQuotaSummary ¶
func (gqm *GroupQuotaManager) GetQuotaSummary(quotaName string, includePods bool) (*QuotaInfoSummary, bool)
func (*GroupQuotaManager) GetTreeID ¶ added in v1.4.0
func (gqm *GroupQuotaManager) GetTreeID() string
func (*GroupQuotaManager) MigratePod ¶ added in v1.0.0
func (gqm *GroupQuotaManager) MigratePod(pod *v1.Pod, out, in string)
func (*GroupQuotaManager) OnNodeAdd ¶ added in v1.4.0
func (gqm *GroupQuotaManager) OnNodeAdd(node *v1.Node)
func (*GroupQuotaManager) OnNodeDelete ¶ added in v1.4.0
func (gqm *GroupQuotaManager) OnNodeDelete(node *v1.Node)
func (*GroupQuotaManager) OnNodeUpdate ¶ added in v1.4.0
func (gqm *GroupQuotaManager) OnNodeUpdate(oldNode, newNode *v1.Node)
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) ReservePod ¶ added in v1.0.0
func (gqm *GroupQuotaManager) ReservePod(quotaName string, p *v1.Pod)
func (*GroupQuotaManager) SetTotalResourceForTree ¶ added in v1.4.0
func (gqm *GroupQuotaManager) SetTotalResourceForTree(total v1.ResourceList) v1.ResourceList
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 (*GroupQuotaManager) UpdateQuota ¶
func (gqm *GroupQuotaManager) UpdateQuota(quota *v1alpha1.ElasticQuota, isDelete bool) error
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 non-preemptible pods used NonPreemptibleUsed v1.ResourceList // All pods request Request v1.ResourceList // All non-preemptible pods request NonPreemptibleRequest v1.ResourceList // ChildRquest is the sum of child quota requests. // If the quota is leaf, it's the sum of pods requests ChildRequest v1.ResourceList SharedWeight v1.ResourceList // Runtime is the current actual resource that can be used by the quota group Runtime v1.ResourceList // If the allocated is greater than min, the guaranteed resource is the allocated, // else the guaranteed is the min. Guaranteed v1.ResourceList // Allocated is the allocated resource. It's the sum of children quota guarantee. If the quota is leaf, it's // the sum of scheduled pods Allocated 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 NewQuotaInfoFromQuota ¶
func NewQuotaInfoFromQuota(quota *v1alpha1.ElasticQuota) *QuotaInfo
func (*QuotaInfo) CheckPodIsAssigned ¶ added in v1.2.0
func (*QuotaInfo) GetAllocated ¶ added in v1.4.0
func (qi *QuotaInfo) GetAllocated() v1.ResourceList
func (*QuotaInfo) GetChildRequest ¶ added in v1.4.0
func (qi *QuotaInfo) GetChildRequest() v1.ResourceList
func (*QuotaInfo) GetGuaranteed ¶ added in v1.4.0
func (qi *QuotaInfo) GetGuaranteed() v1.ResourceList
func (*QuotaInfo) GetMax ¶ added in v1.4.0
func (qi *QuotaInfo) GetMax() v1.ResourceList
func (*QuotaInfo) GetMin ¶ added in v1.4.0
func (qi *QuotaInfo) GetMin() v1.ResourceList
func (*QuotaInfo) GetNonPreemptibleRequest ¶ added in v1.4.0
func (qi *QuotaInfo) GetNonPreemptibleRequest() v1.ResourceList
func (*QuotaInfo) GetNonPreemptibleUsed ¶ added in v1.4.0
func (qi *QuotaInfo) GetNonPreemptibleUsed() v1.ResourceList
func (*QuotaInfo) GetPodThatIsAssigned ¶ added in v1.1.1
func (*QuotaInfo) GetQuotaSummary ¶
func (qi *QuotaInfo) GetQuotaSummary(treeID string, includePods bool) *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
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"` Tree string `json:"tree"` Max v1.ResourceList `json:"max"` Min v1.ResourceList `json:"min"` AutoScaleMin v1.ResourceList `json:"autoScaleMin"` Used v1.ResourceList `json:"used"` NonPreemptibleUsed v1.ResourceList `json:"nonPreemptibleUsed"` Request v1.ResourceList `json:"request"` NonPreemptibleRequest v1.ResourceList `json:"nonPreemptibleRequest"` Runtime v1.ResourceList `json:"runtime"` ChildRequest v1.ResourceList `json:"childRequest"` Allocated v1.ResourceList `json:"allocated"` Guaranteed v1.ResourceList `json:"guaranteed"` PodCache map[string]*SimplePodInfo `json:"podCache,omitempty"` }
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(name string, 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"` }