executor

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2023 License: Apache-2.0, BSD-2-Clause Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxUpQuota          = 60 * 1000 // 60CU
	CpuQuotaCoefficient = 1000.0
	MaxRatio            = 100.0
)

Be consistent with metrics in collector/types/types.go

View Source
const (
	DefaultCoolDownSeconds = 300
)

Variables

This section is empty.

Functions

func Reverse added in v0.6.0

func Reverse(t ThrottlePods) []podinfo.PodContext

Types

type ActionExecutor added in v0.2.0

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

func NewActionExecutor added in v0.2.0

func NewActionExecutor(client clientset.Interface, nodeName string, podInformer coreinformers.PodInformer, nodeInformer coreinformers.NodeInformer,
	noticeCh <-chan AvoidanceExecutor, runtimeEndpoint string, stateMap map[string][]common.TimeSeries, executeExcess string) *ActionExecutor

NewActionExecutor create enforcer manager

func (*ActionExecutor) Name added in v0.2.0

func (a *ActionExecutor) Name() string

func (*ActionExecutor) Run added in v0.2.0

func (a *ActionExecutor) Run(stop <-chan struct{})

type AvoidanceExecutor

type AvoidanceExecutor struct {
	ScheduleExecutor ScheduleExecutor
	ThrottleExecutor ThrottleExecutor
	EvictExecutor    EvictExecutor
	StateMap         map[string][]common.TimeSeries
}

type EvictExecutor

type EvictExecutor struct {
	EvictPods EvictPods
	// All metrics(not only can be quantified metrics) metioned in triggerd NodeQOS and their corresponding watermarks
	EvictWatermark Watermarks
}

func (*EvictExecutor) Avoid

func (e *EvictExecutor) Avoid(ctx *ExecuteContext) error

func (*EvictExecutor) Restore

func (e *EvictExecutor) Restore(ctx *ExecuteContext) error

type EvictPods

type EvictPods []podinfo.PodContext

func (EvictPods) Find

func (e EvictPods) Find(key types.NamespacedName) int

type ExecuteContext

type ExecuteContext struct {
	NodeName      string
	Client        clientset.Interface
	PodLister     corelisters.PodLister
	NodeLister    corelisters.NodeLister
	RuntimeClient pb.RuntimeServiceClient
	RuntimeConn   *grpc.ClientConn

	// Gap for metrics Evictable/ThrottleAble
	// Key is the metric name, value is (actual used)-(the lowest watermark for NodeQOSEnsurancePolicies which use throttleDown action)
	ToBeThrottleDown Gaps
	// Key is the metric name, value is (actual used)-(the lowest watermark for NodeQOSEnsurancePolicies which use throttleUp action)
	ToBeThrottleUp Gaps
	// key is the metric name, value is (actual used)-(the lowest watermark for NodeQOSEnsurancePolicies which use evict action)
	ToBeEvict Gaps
	// contains filtered or unexported fields
}

type Executor

type Executor interface {
	Avoid(ctx *ExecuteContext) error
	Restore(ctx *ExecuteContext) error
}

type Gaps added in v0.8.0

type Gaps map[WatermarkMetric]float64

Gaps key is metric name, value is the difference between usage and the smallest watermark

func (Gaps) GapsAllRemoved added in v0.8.0

func (g Gaps) GapsAllRemoved() bool

Whether no gaps in Gaps

func (Gaps) HasUsageMissedMetric added in v0.8.0

func (g Gaps) HasUsageMissedMetric() bool

Whether there is a metric that can't get usage in Gaps

func (Gaps) TargetGapsRemoved added in v0.8.0

func (g Gaps) TargetGapsRemoved(metric WatermarkMetric) bool

For a specified metric in Gaps, whether there still has gap

type ReleaseResource added in v0.6.0

type ReleaseResource map[WatermarkMetric]float64

func (ReleaseResource) Add added in v0.6.0

func (r ReleaseResource) Add(new ReleaseResource)

type ScheduleExecutor added in v0.2.0

type ScheduleExecutor struct {
	ToBeDisable, ToBeRestore bool
}

func (*ScheduleExecutor) Avoid added in v0.2.0

func (b *ScheduleExecutor) Avoid(ctx *ExecuteContext) error

func (*ScheduleExecutor) Restore added in v0.2.0

func (b *ScheduleExecutor) Restore(ctx *ExecuteContext) error

type ThrottleExecutor

type ThrottleExecutor struct {
	ThrottleDownPods ThrottlePods
	ThrottleUpPods   ThrottlePods
	// All metrics(not only metrics that can be quantified) metioned in triggerd NodeQOS and their corresponding watermarks
	ThrottleDownWatermark Watermarks
	ThrottleUpWatermark   Watermarks
}

func (*ThrottleExecutor) Avoid

func (t *ThrottleExecutor) Avoid(ctx *ExecuteContext) error

func (*ThrottleExecutor) Restore

func (t *ThrottleExecutor) Restore(ctx *ExecuteContext) error

type ThrottlePods added in v0.2.0

type ThrottlePods []podinfo.PodContext

func (ThrottlePods) Find added in v0.2.0

func (t ThrottlePods) Find(podTypes types.NamespacedName) int

type Watermark added in v0.8.0

type Watermark []resource.Quantity

An Watermark is a min-heap of Quantity. The values come from each objectiveEnsurance.metricRule.value

func (Watermark) Len added in v0.8.0

func (w Watermark) Len() int

func (Watermark) Less added in v0.8.0

func (w Watermark) Less(i, j int) bool

func (*Watermark) Pop added in v0.8.0

func (w *Watermark) Pop() interface{}

func (*Watermark) PopSmallest added in v0.8.0

func (w *Watermark) PopSmallest() *resource.Quantity

func (*Watermark) Push added in v0.8.0

func (w *Watermark) Push(x interface{})

func (Watermark) String added in v0.8.0

func (w Watermark) String() string

func (Watermark) Swap added in v0.8.0

func (w Watermark) Swap(i, j int)

type WatermarkMetric added in v0.8.0

type WatermarkMetric string

WatermarkMetric defines metrics that can be measured for watermark Should be consistent with metrics in collector/types/types.go

type Watermarks added in v0.8.0

type Watermarks map[WatermarkMetric]*Watermark

Watermarks 's key is the metric name, value is watermark which get from each objectiveEnsurance.metricRule.value

func (Watermarks) DivideMetricsByEvictQuantified added in v0.8.0

func (e Watermarks) DivideMetricsByEvictQuantified() (quantified []WatermarkMetric, notQuantified []WatermarkMetric)

DivideMetricsByEvictQuantified divide metrics in watermarks into can be EvictQuantified and can not be EvictQuantified

func (Watermarks) DivideMetricsByThrottleQuantified added in v0.8.0

func (e Watermarks) DivideMetricsByThrottleQuantified() (MetricsThrottleQuantified []WatermarkMetric, MetricsNotThrottleQuantified []WatermarkMetric)

DivideMetricsByThrottleQuantified divide metrics by whether metrics can be throttleQuantified

func (Watermarks) GetHighestPriorityEvictableMetric added in v0.8.0

func (e Watermarks) GetHighestPriorityEvictableMetric() (highestPrioriyMetric WatermarkMetric)

GetHighestPriorityEvictableMetric get the highest priority in metrics that can be Evictable

func (Watermarks) GetHighestPriorityThrottleAbleMetric added in v0.8.0

func (e Watermarks) GetHighestPriorityThrottleAbleMetric() (highestPrioriyMetric WatermarkMetric)

GetHighestPriorityThrottleAbleMetric get the highest priority in metrics from watermarks

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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