context

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBaseScalingContext

func NewBaseScalingContext() *baseScalingContext

NewBaseScalingContext creates a new instance of BaseScalingContext with default values.

Types

type AnnotationError added in v0.8.0

type AnnotationError struct {
	Key   string
	Value string
	Err   error
}

AnnotationError reports one autoscaling annotation whose value cannot be used.

func ValidateAnnotations added in v0.8.0

func ValidateAnnotations(annotations map[string]string) []AnnotationError

ValidateAnnotations checks every autoscaling annotation the controller understands and returns one error per unusable value, ordered by key. Annotations the controller does not read are ignored.

func (AnnotationError) Error added in v0.8.0

func (e AnnotationError) Error() string

func (AnnotationError) Unwrap added in v0.8.0

func (e AnnotationError) Unwrap() error

type MetricTarget

type MetricTarget struct {
	// The value of scaling metric per pod that we target to maintain.
	TargetValue float64
	// The total value of scaling metric that a pod can maintain.
	TotalValue float64
	// The metric used for scaling, i.e. CPU, Memory, QPS.
	ScalingMetric string
	MetricType    autoscalingv1alpha1.MetricSourceType
}

type ScalingContext

type ScalingContext interface {
	GetTargetValueForMetric(metricName string) (float64, bool)
	GetMetricSourceTypeForMetric(metricName string) (autoscalingv1alpha1.MetricSourceType, bool)
	GetUpFluctuationTolerance() float64
	GetDownFluctuationTolerance() float64
	GetMaxScaleUpRate() float64
	GetMaxScaleDownRate() float64
	GetCurrentUsePerPod() float64
	SetCurrentUsePerPod(float64)
	UpdateByPaTypes(pa *autoscalingv1alpha1.PodAutoscaler) error
	GetMinReplicas() int32
	GetMaxReplicas() int32
	GetStableValue() float64
	SetStableValue(float64)
	GetPanicValue() float64
	SetPanicValue(float64)
	SetActivationScale(value int32)
	GetActivationScale() int32
	GetPanicThreshold() float64
	GetInPanicMode() bool
	SetInPanicMode(bool)
	GetMaxPanicPods() int32
	SetMaxPanicPods(int32)
	GetScaleUpCooldownWindow() time.Duration
	GetScaleDownCooldownWindow() time.Duration
	GetScaleToZero() bool
}

ScalingContext defines the generalized context that holds all necessary data for scaling calculations. This is the single source of truth for all scaling configuration, extracted per-PodAutoscaler.

Jump to

Keyboard shortcuts

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