strategy

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetGetPodPoolMapFunc

func SetGetPodPoolMapFunc(f GetPodPoolMapFunc)

SetGetPodPoolMapFunc provides a hook to change the implementation of GetPodPoolMapFunc

Types

type CPUPressureEviction

type CPUPressureEviction interface {
	Start(context.Context) (err error)
	Name() string
}

type CPUPressureLoadEviction

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

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) Name

func (p *CPUPressureSuppression) Name() string

func (*CPUPressureSuppression) Start

type ContainerOwnerPoolInfo

type ContainerOwnerPoolInfo struct {
	OwnerPool string
	PoolSize  int
	IsPool    bool
}

type Entries

type Entries map[string]SubEntries

Entries are keyed by pod UID or pool name

type GetPodPoolMapFunc

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

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

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)

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