resmanager

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2022 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RootResctrlGroup is the name of the root resctrl group
	RootResctrlGroup = ""
	// LSRResctrlGroup is the name of LSR resctrl group
	LSRResctrlGroup = "LSR"
	// LSResctrlGroup is the name of LS resctrl group
	LSResctrlGroup = "LS"
	// BEResctrlGroup is the name of BE resctrl group
	BEResctrlGroup = "BE"
	// UnknownResctrlGroup is the resctrl group which is unknown to reconcile
	UnknownResctrlGroup = "Unknown"
	// L3SchemataPrefix is the prefix of l3 cat schemata
	L3SchemataPrefix = "L3:"
	// MbSchemataPrefix is the prefix of l3 cat schemata
	MbSchemataPrefix = "MB:"
)
View Source
const (
	CgroupResourcesReconcileForceUpdateSeconds int = 60
)

Variables

This section is empty.

Functions

func CommonCgroupUpdateFunc added in v0.3.0

func CommonCgroupUpdateFunc(resource ResourceUpdater) error

func CommonUpdateFunc added in v0.3.0

func CommonUpdateFunc(resource ResourceUpdater) error

Types

type CPUBurst added in v0.3.0

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

func NewCPUBurst added in v0.3.0

func NewCPUBurst(resmanager *resmanager) *CPUBurst

func (*CPUBurst) Recycle added in v0.3.0

func (b *CPUBurst) Recycle()

type CPUEvictor added in v0.4.0

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

func NewCPUEvictor added in v0.4.0

func NewCPUEvictor(resmanager *resmanager) *CPUEvictor

type CPUSuppress

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

func NewCPUSuppress

func NewCPUSuppress(resmanager *resmanager) *CPUSuppress

type CacheExecutor added in v0.3.0

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 added in v0.3.0

type CgroupResourceUpdater struct {
	ParentDir string
	// contains filtered or unexported fields
}

func NewCommonCgroupResourceUpdater added in v0.3.0

func NewCommonCgroupResourceUpdater(owner *OwnerRef, parentDir string, file system.CgroupFile, value string) *CgroupResourceUpdater

func NewMergeableCgroupResourceUpdater added in v0.3.0

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) Clone added in v0.3.0

func (*CgroupResourceUpdater) GetLastUpdateTimestamp added in v0.3.0

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

func (*CgroupResourceUpdater) Key added in v0.3.0

func (c *CgroupResourceUpdater) Key() string

func (*CgroupResourceUpdater) MergeUpdate added in v0.3.0

func (*CgroupResourceUpdater) NeedMerge added in v0.3.0

func (c *CgroupResourceUpdater) NeedMerge() bool

func (*CgroupResourceUpdater) Owner added in v0.3.0

func (c *CgroupResourceUpdater) Owner() *OwnerRef

func (*CgroupResourceUpdater) SetValue added in v0.3.0

func (c *CgroupResourceUpdater) SetValue(value string)

func (*CgroupResourceUpdater) Update added in v0.3.0

func (c *CgroupResourceUpdater) Update() error

func (*CgroupResourceUpdater) UpdateLastUpdateTimestamp added in v0.3.0

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

func (*CgroupResourceUpdater) Value added in v0.3.0

func (c *CgroupResourceUpdater) Value() string

type CgroupResourcesReconcile added in v0.3.0

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

func NewCgroupResourcesReconcile added in v0.3.0

func NewCgroupResourcesReconcile(resmanager *resmanager) *CgroupResourcesReconcile

func (*CgroupResourcesReconcile) RunInit added in v0.3.0

func (m *CgroupResourcesReconcile) RunInit(stopCh <-chan struct{}) error

type CommonResourceUpdater added in v0.3.0

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

func NewCommonResourceUpdater added in v0.3.0

func NewCommonResourceUpdater(file string, value string) *CommonResourceUpdater

func NewDetailCommonResourceUpdater added in v0.3.0

func NewDetailCommonResourceUpdater(key, file, value string, owner *OwnerRef, updateFunc UpdateFunc) *CommonResourceUpdater

func (*CommonResourceUpdater) Clone added in v0.3.0

func (*CommonResourceUpdater) GetLastUpdateTimestamp added in v0.3.0

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

func (*CommonResourceUpdater) Key added in v0.3.0

func (c *CommonResourceUpdater) Key() string

func (*CommonResourceUpdater) Owner added in v0.3.0

func (c *CommonResourceUpdater) Owner() *OwnerRef

func (*CommonResourceUpdater) SetValue added in v0.3.0

func (c *CommonResourceUpdater) SetValue(value string)

func (*CommonResourceUpdater) Update added in v0.3.0

func (c *CommonResourceUpdater) Update() error

func (*CommonResourceUpdater) UpdateLastUpdateTimestamp added in v0.3.0

func (c *CommonResourceUpdater) UpdateLastUpdateTimestamp(time time.Time)

func (*CommonResourceUpdater) Value added in v0.3.0

func (c *CommonResourceUpdater) Value() string

type Config

type Config struct {
	ReconcileIntervalSeconds   int
	CPUSuppressIntervalSeconds int
	CPUEvictIntervalSeconds    int
	MemoryEvictIntervalSeconds int
	MemoryEvictCoolTimeSeconds int
	CPUEvictCoolTimeSeconds    int
}

func NewDefaultConfig

func NewDefaultConfig() *Config

func (*Config) InitFlags

func (c *Config) InitFlags(fs *flag.FlagSet)

type LeveledCacheExecutor added in v0.3.0

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 added in v0.3.0

type LeveledResourceUpdateExecutor struct {
	ResourceUpdateExecutor
}

func NewLeveledResourceUpdateExecutor added in v0.3.0

func NewLeveledResourceUpdateExecutor(name string, forceUpdateSeconds int) *LeveledResourceUpdateExecutor

func (*LeveledResourceUpdateExecutor) LeveledUpdateBatch added in v0.3.0

func (e *LeveledResourceUpdateExecutor) LeveledUpdateBatch(resources [][]MergeableResourceUpdater) (updated bool)

LeveledUpdateBatch update a batch of resources by the level order.

func (*LeveledResourceUpdateExecutor) LeveledUpdateBatchByCache added in v0.3.0

func (e *LeveledResourceUpdateExecutor) LeveledUpdateBatchByCache(resources [][]MergeableResourceUpdater) (updated bool)

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 MemoryEvictor added in v0.2.0

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

func NewMemoryEvictor added in v0.2.0

func NewMemoryEvictor(mgr *resmanager) *MemoryEvictor

type MergeUpdateFunc added in v0.3.0

type MergeUpdateFunc func(resource MergeableResourceUpdater) (MergeableResourceUpdater, error)

type MergeableResourceUpdater added in v0.3.0

type MergeableResourceUpdater interface {
	ResourceUpdater
	MergeUpdate() (MergeableResourceUpdater, error)
	NeedMerge() bool
}

type OwnerRef added in v0.3.0

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 added in v0.3.0

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

func GroupOwnerRef added in v0.3.0

func GroupOwnerRef(name string) *OwnerRef

func PodOwnerRef added in v0.3.0

func PodOwnerRef(ns string, name string) *OwnerRef

type OwnerType added in v0.3.0

type OwnerType int

type ResManager

type ResManager interface {
	Run(stopCh <-chan struct{}) error
}

func NewResManager

func NewResManager(cfg *Config, schema *apiruntime.Scheme, kubeClient clientset.Interface, crdClient *koordclientset.Clientset, nodeName string,
	statesInformer statesinformer.StatesInformer, metricCache metriccache.MetricCache, collectResUsedIntervalSeconds int64) ResManager

type ResctrlReconcile added in v0.3.0

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

func NewResctrlReconcile added in v0.3.0

func NewResctrlReconcile(resManager *resmanager) *ResctrlReconcile

func (*ResctrlReconcile) RunInit added in v0.3.0

func (r *ResctrlReconcile) RunInit(stopCh <-chan struct{}) error

type ResourceUpdateExecutor added in v0.3.0

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

func NewResourceUpdateExecutor added in v0.3.0

func NewResourceUpdateExecutor(name string, forceUpdateSeconds int) *ResourceUpdateExecutor

func (*ResourceUpdateExecutor) Run added in v0.3.0

func (rm *ResourceUpdateExecutor) Run(stopCh <-chan struct{})

func (*ResourceUpdateExecutor) Update added in v0.3.0

func (rm *ResourceUpdateExecutor) Update(resource ResourceUpdater) error

func (*ResourceUpdateExecutor) UpdateBatch added in v0.3.0

func (rm *ResourceUpdateExecutor) UpdateBatch(resources ...ResourceUpdater)

func (*ResourceUpdateExecutor) UpdateBatchByCache added in v0.3.0

func (rm *ResourceUpdateExecutor) UpdateBatchByCache(resources ...ResourceUpdater) (updated bool)

func (*ResourceUpdateExecutor) UpdateByCache added in v0.3.0

func (rm *ResourceUpdateExecutor) UpdateByCache(resource ResourceUpdater) (updated bool, err error)

func (*ResourceUpdateExecutor) UpdateWithoutErr added in v0.3.0

func (rm *ResourceUpdateExecutor) UpdateWithoutErr(resourceUpdater ResourceUpdater) bool

type ResourceUpdater added in v0.3.0

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
}

type UpdateFunc added in v0.3.0

type UpdateFunc func(resource ResourceUpdater) error

Jump to

Keyboard shortcuts

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