Documentation ¶
Index ¶
- Constants
- func CommonCgroupUpdateFunc(resource ResourceUpdater) error
- func CommonUpdateFunc(resource ResourceUpdater) error
- func UpdateResctrlSchemataFunc(resource ResourceUpdater) error
- func UpdateResctrlTasksFunc(resource ResourceUpdater) error
- type CacheExecutor
- type CgroupResourceUpdater
- func (c *CgroupResourceUpdater) ClearUpdateFunc()
- func (c *CgroupResourceUpdater) Clone() ResourceUpdater
- func (c *CgroupResourceUpdater) GetLastUpdateTimestamp() time.Time
- func (c *CgroupResourceUpdater) Key() string
- func (c *CgroupResourceUpdater) MergeUpdate() (MergeableResourceUpdater, error)
- func (c *CgroupResourceUpdater) NeedMerge() bool
- func (c *CgroupResourceUpdater) Owner() *OwnerRef
- func (c *CgroupResourceUpdater) SetValue(value string)
- func (c *CgroupResourceUpdater) Update() error
- func (c *CgroupResourceUpdater) UpdateLastUpdateTimestamp(time time.Time)
- func (c *CgroupResourceUpdater) Value() string
- type CommonResourceUpdater
- func (c *CommonResourceUpdater) Clone() ResourceUpdater
- func (c *CommonResourceUpdater) GetLastUpdateTimestamp() time.Time
- func (c *CommonResourceUpdater) Key() string
- func (c *CommonResourceUpdater) Owner() *OwnerRef
- func (c *CommonResourceUpdater) SetValue(value string)
- func (c *CommonResourceUpdater) Update() error
- func (c *CommonResourceUpdater) UpdateLastUpdateTimestamp(time time.Time)
- func (c *CommonResourceUpdater) Value() string
- type LeveledCacheExecutor
- type LeveledResourceUpdateExecutor
- type MergeUpdateFunc
- type MergeableResourceUpdater
- type OwnerRef
- type OwnerType
- type ResourceUpdateExecutor
- func (rm *ResourceUpdateExecutor) Run(stopCh <-chan struct{})
- func (rm *ResourceUpdateExecutor) Update(resource ResourceUpdater) error
- func (rm *ResourceUpdateExecutor) UpdateBatch(resources ...ResourceUpdater)
- func (rm *ResourceUpdateExecutor) UpdateBatchByCache(resources ...ResourceUpdater) (updated bool)
- func (rm *ResourceUpdateExecutor) UpdateByCache(resource ResourceUpdater) (updated bool, err error)
- func (rm *ResourceUpdateExecutor) UpdateWithoutErr(resourceUpdater ResourceUpdater) bool
- type ResourceUpdater
- type UpdateFunc
Constants ¶
const ( UpdateCPU = "UpdateCPU" UpdateMemory = "UpdateMemory" EvictPodByNodeMemoryUsage = "EvictPodByNodeMemoryUsage" EvictPodByBECPUSatisfaction = "EvictPodByBECPUSatisfaction" AdjustBEByNodeCPUUsage = "AdjustBEByNodeCPUUsage" )
const ( // L3SchemataPrefix is the prefix of l3 cat schemata L3SchemataPrefix = "L3:" // MbSchemataPrefix is the prefix of l3 cat schemata MbSchemataPrefix = "MB:" )
const ( NodeType = iota PodType ContainerType GroupType OthersType )
Variables ¶
This section is empty.
Functions ¶
func CommonCgroupUpdateFunc ¶
func CommonCgroupUpdateFunc(resource ResourceUpdater) error
func CommonUpdateFunc ¶
func CommonUpdateFunc(resource ResourceUpdater) error
func UpdateResctrlSchemataFunc ¶
func UpdateResctrlSchemataFunc(resource ResourceUpdater) error
func UpdateResctrlTasksFunc ¶
func UpdateResctrlTasksFunc(resource ResourceUpdater) error
Types ¶
type CacheExecutor ¶
type CacheExecutor interface { UpdateByCache(resource ResourceUpdater) (updated bool, err error) UpdateWithoutErr(resource ResourceUpdater) (updated bool) Update(resource ResourceUpdater) error Run(stopCh <-chan struct{}) }
type CgroupResourceUpdater ¶
type CgroupResourceUpdater struct { ParentDir string // contains filtered or unexported fields }
func NewCommonCgroupResourceUpdater ¶
func NewCommonCgroupResourceUpdater(owner *OwnerRef, parentDir string, file system.CgroupFile, value string) *CgroupResourceUpdater
func NewMergeableCgroupResourceUpdater ¶
func NewMergeableCgroupResourceUpdater(owner *OwnerRef, parentDir string, file system.CgroupFile, value string, mergeUpdateFunc MergeUpdateFunc) *CgroupResourceUpdater
NewMergeableCgroupResourceUpdater returns a leveled CgroupResourceUpdater which firstly MergeUpdate from top to bottom and then Update from bottom to top.
func (*CgroupResourceUpdater) ClearUpdateFunc ¶
func (c *CgroupResourceUpdater) ClearUpdateFunc()
func (*CgroupResourceUpdater) Clone ¶
func (c *CgroupResourceUpdater) Clone() ResourceUpdater
func (*CgroupResourceUpdater) GetLastUpdateTimestamp ¶
func (c *CgroupResourceUpdater) GetLastUpdateTimestamp() time.Time
func (*CgroupResourceUpdater) Key ¶
func (c *CgroupResourceUpdater) Key() string
func (*CgroupResourceUpdater) MergeUpdate ¶
func (c *CgroupResourceUpdater) MergeUpdate() (MergeableResourceUpdater, error)
func (*CgroupResourceUpdater) NeedMerge ¶
func (c *CgroupResourceUpdater) NeedMerge() bool
func (*CgroupResourceUpdater) Owner ¶
func (c *CgroupResourceUpdater) Owner() *OwnerRef
func (*CgroupResourceUpdater) SetValue ¶
func (c *CgroupResourceUpdater) SetValue(value string)
func (*CgroupResourceUpdater) Update ¶
func (c *CgroupResourceUpdater) Update() error
func (*CgroupResourceUpdater) UpdateLastUpdateTimestamp ¶
func (c *CgroupResourceUpdater) UpdateLastUpdateTimestamp(time time.Time)
func (*CgroupResourceUpdater) Value ¶
func (c *CgroupResourceUpdater) Value() string
type CommonResourceUpdater ¶
type CommonResourceUpdater struct {
// contains filtered or unexported fields
}
func NewCommonResourceUpdater ¶
func NewCommonResourceUpdater(file string, value string) *CommonResourceUpdater
func NewDetailCommonResourceUpdater ¶
func NewDetailCommonResourceUpdater(key, file, value string, owner *OwnerRef, updateFunc UpdateFunc) *CommonResourceUpdater
func (*CommonResourceUpdater) Clone ¶
func (c *CommonResourceUpdater) Clone() ResourceUpdater
func (*CommonResourceUpdater) GetLastUpdateTimestamp ¶
func (c *CommonResourceUpdater) GetLastUpdateTimestamp() time.Time
func (*CommonResourceUpdater) Key ¶
func (c *CommonResourceUpdater) Key() string
func (*CommonResourceUpdater) Owner ¶
func (c *CommonResourceUpdater) Owner() *OwnerRef
func (*CommonResourceUpdater) SetValue ¶
func (c *CommonResourceUpdater) SetValue(value string)
func (*CommonResourceUpdater) Update ¶
func (c *CommonResourceUpdater) Update() error
func (*CommonResourceUpdater) UpdateLastUpdateTimestamp ¶
func (c *CommonResourceUpdater) UpdateLastUpdateTimestamp(time time.Time)
func (*CommonResourceUpdater) Value ¶
func (c *CommonResourceUpdater) Value() string
type LeveledCacheExecutor ¶
type LeveledCacheExecutor interface { CacheExecutor LeveledUpdateBatchByCache(resources [][]MergeableResourceUpdater) (updated bool) LeveledUpdateBatch(resources [][]MergeableResourceUpdater) (updated bool) }
LeveledCacheExecutor is a cacheable executor to update resources by the order of resources' level For cgroup interfaces like `cpuset.cpus` and `memory.min`, reconciliation from top to bottom should keep the upper value larger/broader than the lower. Thus a Leveled updater is implemented as follows:
- update batch of cgroup resources group by cgroup interface, i.e. cgroup filename.
- update each cgroup resource by the order of layers: firstly update resources from upper to lower by merging the new value with old value; then update resources from lower to upper with the new value.
type LeveledResourceUpdateExecutor ¶
type LeveledResourceUpdateExecutor struct {
ResourceUpdateExecutor
}
func NewLeveledResourceUpdateExecutor ¶
func NewLeveledResourceUpdateExecutor(name string, forceUpdateSeconds int) *LeveledResourceUpdateExecutor
func (*LeveledResourceUpdateExecutor) LeveledUpdateBatch ¶
func (e *LeveledResourceUpdateExecutor) LeveledUpdateBatch(resources [][]MergeableResourceUpdater)
LeveledUpdateBatch update a batch of resources by the level order.
func (*LeveledResourceUpdateExecutor) LeveledUpdateBatchByCache ¶
func (e *LeveledResourceUpdateExecutor) LeveledUpdateBatchByCache(resources [][]MergeableResourceUpdater)
LeveledUpdateBatchByCache update a batch of resources by the level order cacheable. It firstly merge updates resources from top to bottom, and then updates resources from bottom to top. It is compatible for some of resources which just need to update once but not have an additional merge update.
type MergeUpdateFunc ¶
type MergeUpdateFunc func(resource MergeableResourceUpdater) (MergeableResourceUpdater, error)
type MergeableResourceUpdater ¶
type MergeableResourceUpdater interface { ResourceUpdater MergeUpdate() (MergeableResourceUpdater, error) NeedMerge() bool }
func MergeFuncUpdateCgroupIfLarger ¶
func MergeFuncUpdateCgroupIfLarger(resource MergeableResourceUpdater) (MergeableResourceUpdater, error)
type OwnerRef ¶
OwnerRef is used to record the object that needs to be modified or the source object that triggers the modification
func GroupOwnerRef ¶
func PodOwnerRef ¶
type ResourceUpdateExecutor ¶
type ResourceUpdateExecutor struct {
// contains filtered or unexported fields
}
func NewResourceUpdateExecutor ¶
func NewResourceUpdateExecutor(name string, forceUpdateSeconds int) *ResourceUpdateExecutor
func (*ResourceUpdateExecutor) Run ¶
func (rm *ResourceUpdateExecutor) Run(stopCh <-chan struct{})
func (*ResourceUpdateExecutor) Update ¶
func (rm *ResourceUpdateExecutor) Update(resource ResourceUpdater) error
func (*ResourceUpdateExecutor) UpdateBatch ¶
func (rm *ResourceUpdateExecutor) UpdateBatch(resources ...ResourceUpdater)
func (*ResourceUpdateExecutor) UpdateBatchByCache ¶
func (rm *ResourceUpdateExecutor) UpdateBatchByCache(resources ...ResourceUpdater) (updated bool)
func (*ResourceUpdateExecutor) UpdateByCache ¶
func (rm *ResourceUpdateExecutor) UpdateByCache(resource ResourceUpdater) (updated bool, err error)
func (*ResourceUpdateExecutor) UpdateWithoutErr ¶
func (rm *ResourceUpdateExecutor) UpdateWithoutErr(resourceUpdater ResourceUpdater) bool
type ResourceUpdater ¶
type ResourceUpdater interface { // RefObject reference to the object Owner() *OwnerRef Key() string Value() string GetLastUpdateTimestamp() time.Time SetValue(value string) UpdateLastUpdateTimestamp(time time.Time) Clone() ResourceUpdater Update() error }
func CalculateL3SchemataResource ¶
func CalculateL3SchemataResource(group, schemataDelta string, l3Num int) ResourceUpdater
func CalculateL3TasksResource ¶
func CalculateL3TasksResource(group string, taskIds []int) ResourceUpdater
func CalculateMbSchemataResource ¶
func CalculateMbSchemataResource(group, schemataDelta string, l3Num int) ResourceUpdater
type UpdateFunc ¶
type UpdateFunc func(resource ResourceUpdater) error