executor

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2022 License: Apache-2.0 Imports: 25 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
)
View Source
const (
	// We can't get current use, so can't do actions precisely, just evict every evictedPod
	MissedCurrentUsage float64 = math.MaxFloat64
)

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 NodeQOSEnsurancePolicy and their corresponding waterlines
	EvictWaterLine WaterLines
}

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 waterline for NodeQOSEnsurancePolicies which use throttleDown action)
	ThrottoleDownGapToWaterLines GapToWaterLines
	// Key is the metric name, value is (actual used)-(the lowest waterline for NodeQOSEnsurancePolicies which use throttleUp action)
	ThrottoleUpGapToWaterLines GapToWaterLines
	// key is the metric name, value is (actual used)-(the lowest waterline for NodeQOSEnsurancePolicies which use evict action)
	EvictGapToWaterLines GapToWaterLines
	// contains filtered or unexported fields
}

type Executor

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

type GapToWaterLines added in v0.6.0

type GapToWaterLines map[WaterLineMetric]float64

GapToWaterLines's key is metric name, value is the difference between usage and the smallest waterline

func (GapToWaterLines) GapsAllRemoved added in v0.6.0

func (g GapToWaterLines) GapsAllRemoved() bool

Whether no gaps in GapToWaterLines

func (GapToWaterLines) HasUsageMissedMetric added in v0.6.0

func (g GapToWaterLines) HasUsageMissedMetric() bool

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

func (GapToWaterLines) TargetGapsRemoved added in v0.6.0

func (g GapToWaterLines) TargetGapsRemoved(metric WaterLineMetric) bool

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

type ReleaseResource added in v0.6.0

type ReleaseResource map[WaterLineMetric]float64

func ConstructCpuUsageRelease added in v0.6.0

func ConstructCpuUsageRelease(pod podinfo.PodContext, containerCPUQuotaNew, currentContainerCpuUsage float64) ReleaseResource

func (ReleaseResource) Add added in v0.6.0

func (r ReleaseResource) Add(new ReleaseResource)

type ScheduleExecutor added in v0.2.0

type ScheduleExecutor struct {
	DisableClassAndPriority *podinfo.ClassAndPriority
	RestoreClassAndPriority *podinfo.ClassAndPriority
}

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 NodeQOSEnsurancePolicy and their corresponding waterlines
	ThrottleDownWaterLine WaterLines
	ThrottleUpWaterLine   WaterLines
}

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

type WaterLine []resource.Quantity

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

func (WaterLine) Len added in v0.6.0

func (w WaterLine) Len() int

func (WaterLine) Less added in v0.6.0

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

func (*WaterLine) Pop added in v0.6.0

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

func (*WaterLine) PopSmallest added in v0.6.0

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

func (*WaterLine) Push added in v0.6.0

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

func (WaterLine) String added in v0.6.0

func (w WaterLine) String() string

func (WaterLine) Swap added in v0.6.0

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

type WaterLineMetric added in v0.6.0

type WaterLineMetric string

Metrics that can be measured for waterLine Should be consistent with metrics in collector/types/types.go

func GetEvictAbleMetricName added in v0.6.0

func GetEvictAbleMetricName() (evictAbleMetricList []WaterLineMetric)

func GetThrottleAbleMetricName added in v0.6.0

func GetThrottleAbleMetricName() (throttleAbleMetricList []WaterLineMetric)

type WaterLines added in v0.6.0

type WaterLines map[WaterLineMetric]*WaterLine

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

func (WaterLines) DivideMetricsByEvictQuantified added in v0.6.0

func (e WaterLines) DivideMetricsByEvictQuantified() (metricsEvictQuantified []WaterLineMetric, metricsNotEvictQuantified []WaterLineMetric)

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

func (WaterLines) DivideMetricsByThrottleQuantified added in v0.6.0

func (e WaterLines) DivideMetricsByThrottleQuantified() (MetricsThrottleQuantified []WaterLineMetric, MetricsNotThrottleQuantified []WaterLineMetric)

DivideMetricsByThrottleQuantified divide metrics by whether metrics can be throttleQuantified

func (WaterLines) GetHighestPriorityEvictAbleMetric added in v0.6.0

func (e WaterLines) GetHighestPriorityEvictAbleMetric() (highestPrioriyMetric WaterLineMetric)

GetHighestPriorityEvictAbleMetric get the highest priority in metrics that can be EvictAble

func (WaterLines) GetHighestPriorityThrottleAbleMetric added in v0.6.0

func (e WaterLines) GetHighestPriorityThrottleAbleMetric() (highestPrioriyMetric WaterLineMetric)

GetHighestPriorityThrottleAbleMetric get the highest priority in metrics from waterlines

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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