strategy

package
v0.5.13 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: Apache-2.0 Imports: 29 Imported by: 1

Documentation

Index

Constants

View Source
const (
	EvictionNameDummy = "cpu-pressure-dummy"
)
View Source
const EvictionNameLoad = "cpu-pressure-load-plugin"
View Source
const EvictionNameSuppression = "cpu-pressure-suppression-plugin"

Variables

This section is empty.

Functions

func NewCPUPressureEvictionPlugin added in v0.4.0

func NewCPUPressureEvictionPlugin(strategy CPUPressureEviction, emitter metrics.MetricEmitter) skeleton.EvictionPlugin

func SetGetPodPoolMapFunc added in v0.3.0

func SetGetPodPoolMapFunc(f GetPodPoolMapFunc)

SetGetPodPoolMapFunc provides a hook to change the implementation of GetPodPoolMapFunc

Types

type CPUPressureEviction

func NewCPUPressureLoadEviction added in v0.3.0

func NewCPUPressureLoadEviction(emitter metrics.MetricEmitter, metaServer *metaserver.MetaServer,
	conf *config.Configuration, readonlyState state.ReadonlyState,
) (CPUPressureEviction, error)

func NewCPUPressureSuppressionEviction

func NewCPUPressureSuppressionEviction(_ metrics.MetricEmitter, metaServer *metaserver.MetaServer,
	conf *config.Configuration, state state.ReadonlyState,
) (CPUPressureEviction, error)

type CPUPressureEvictionPluginWrapper added in v0.4.0

type CPUPressureEvictionPluginWrapper struct {
	CPUPressureEviction

	sync.Mutex
	// contains filtered or unexported fields
}

func (*CPUPressureEvictionPluginWrapper) GetToken added in v0.4.0

GetToken TODO implementation

func (*CPUPressureEvictionPluginWrapper) Start added in v0.4.0

func (p *CPUPressureEvictionPluginWrapper) Start() (err error)

func (*CPUPressureEvictionPluginWrapper) Stop added in v0.4.0

type CPUPressureLoadEviction

type CPUPressureLoadEviction struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*CPUPressureLoadEviction) GetEvictPods added in v0.4.0

func (*CPUPressureLoadEviction) GetTopEvictionPods

func (*CPUPressureLoadEviction) Name

func (p *CPUPressureLoadEviction) Name() string

func (*CPUPressureLoadEviction) Start

func (p *CPUPressureLoadEviction) Start(ctx context.Context) (err error)

func (*CPUPressureLoadEviction) ThresholdMet

type CPUPressureSuppression

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

func (*CPUPressureSuppression) GetEvictPods

func (*CPUPressureSuppression) GetTopEvictionPods added in v0.4.0

func (*CPUPressureSuppression) Name

func (p *CPUPressureSuppression) Name() string

func (*CPUPressureSuppression) Start

func (*CPUPressureSuppression) ThresholdMet added in v0.4.0

type ContainerOwnerPoolInfo added in v0.3.0

type ContainerOwnerPoolInfo struct {
	OwnerPool string
	PoolSize  int
	IsPool    bool
}

type DummyCPUPressureEviction added in v0.4.0

type DummyCPUPressureEviction struct{}

func (*DummyCPUPressureEviction) GetEvictPods added in v0.4.0

func (*DummyCPUPressureEviction) GetTopEvictionPods added in v0.4.0

func (*DummyCPUPressureEviction) Name added in v0.4.0

func (d *DummyCPUPressureEviction) Name() string

func (*DummyCPUPressureEviction) Start added in v0.4.0

func (d *DummyCPUPressureEviction) Start(_ context.Context) (err error)

func (*DummyCPUPressureEviction) ThresholdMet added in v0.4.0

type Entries

type Entries map[string]SubEntries

Entries are keyed by pod UID or pool name

type GetPodPoolMapFunc added in v0.3.0

type GetPodPoolMapFunc func(pod.PodFetcher, state.ReadonlyState) PodPoolMap

GetPodPoolMapFunc returns a map keyed by pod UID, the value is a map keyed by container name and its value is the container info with owner pool.

var DefaultGetPodPoolMapFunc GetPodPoolMapFunc = func(fetcher pod.PodFetcher, readonlyState state.ReadonlyState) PodPoolMap {
	result := make(PodPoolMap)

	for podUID, entry := range readonlyState.GetPodEntries() {
		for containerName, containerEntry := range entry {
			if entry.IsPoolEntry() {
				result.PutContainerOwnerPoolInfo(podUID, containerName, podUID, containerEntry.AllocationResult.Size(), true)
				continue
			}

			if containerEntry == nil {
				continue
			} else if containerEntry.OwnerPoolName == "" {
				general.Infof("skip get pool name for pod: %s, "+
					"container: %s with owner pool name: %s", podUID, containerName, containerEntry.OwnerPoolName)
				continue
			}

			result.PutContainerOwnerPoolInfo(podUID, containerName, containerEntry.OwnerPoolName, containerEntry.AllocationResult.Size(), false)
		}
	}

	return result
}

type MetricInfo

type MetricInfo struct {
	Name       string
	Value      float64
	UpperBound float64
	LowerBound float64
}

type MetricRing

type MetricRing struct {
	MaxLen       int
	Queue        []*MetricSnapshot
	CurrentIndex int

	sync.RWMutex
}

func CreateMetricRing

func CreateMetricRing(size int) *MetricRing

func (*MetricRing) Count

func (ring *MetricRing) Count() (softOverCount, hardOverCount int)

func (*MetricRing) Push

func (ring *MetricRing) Push(snapShot *MetricSnapshot)

func (*MetricRing) Sum

func (ring *MetricRing) Sum() float64

type MetricSnapshot

type MetricSnapshot struct {
	Info MetricInfo
	Time int64
}

type PodPoolMap added in v0.3.0

type PodPoolMap map[string]map[string]*ContainerOwnerPoolInfo

PodPoolMap is a map keyed by pod UID, the value is a map keyed by container name and its value is the container info with owner pool.

func (PodPoolMap) PutContainerOwnerPoolInfo added in v0.3.0

func (p PodPoolMap) PutContainerOwnerPoolInfo(podUID string, containerName string, ownerPool string, poolSize int, isPool bool)

type PoolMetricCollectHandler

type PoolMetricCollectHandler func(dynamicConfig *dynamic.Configuration, poolsUnderPressure bool,
	metricName string, metricValue float64, poolName string,
	poolSize int, collectTime int64, allowSharedCoresOverlapReclaimedCores bool)

type SubEntries

type SubEntries map[string]*MetricRing

SubEntries is keyed by container name or empty string (for pool)

func (SubEntries) IsPoolEntry

func (se SubEntries) IsPoolEntry() bool

Jump to

Keyboard shortcuts

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