executor

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: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UpdateCPU    = "UpdateCPU"
	UpdateMemory = "UpdateMemory"

	EvictPodByNodeMemoryUsage   = "EvictPodByNodeMemoryUsage"
	EvictPodByBECPUSatisfaction = "EvictPodByBECPUSatisfaction"

	AdjustBEByNodeCPUUsage = "AdjustBEByNodeCPUUsage"
)
View Source
const (
	// L3SchemataPrefix is the prefix of l3 cat schemata
	L3SchemataPrefix = "L3:"
	// MbSchemataPrefix is the prefix of l3 cat schemata
	MbSchemataPrefix = "MB:"
)
View Source
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 (*CgroupResourceUpdater) GetLastUpdateTimestamp

func (c *CgroupResourceUpdater) GetLastUpdateTimestamp() time.Time

func (*CgroupResourceUpdater) Key

func (c *CgroupResourceUpdater) Key() string

func (*CgroupResourceUpdater) MergeUpdate

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 (*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:

  1. update batch of cgroup resources group by cgroup interface, i.e. cgroup filename.
  2. 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

type OwnerRef struct {
	Type      OwnerType
	Namespace string
	Name      string
	Container string
}

OwnerRef is used to record the object that needs to be modified or the source object that triggers the modification

func ContainerOwnerRef

func ContainerOwnerRef(ns string, name string, container string) *OwnerRef

func GroupOwnerRef

func GroupOwnerRef(name string) *OwnerRef

func PodOwnerRef

func PodOwnerRef(ns string, name string) *OwnerRef

type OwnerType

type OwnerType int

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

Jump to

Keyboard shortcuts

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