config

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package config provides configuration options for the Predictive Horizontal Pod Autoscaler

Index

Constants

View Source
const (
	// DecisionMaximum means use the highest predicted value from the models
	DecisionMaximum = "maximum"
	// DecisionMinimum means use the lowest predicted value from the models
	DecisionMinimum = "minimum"
	// DecisionMean means use the mean average of predicted values
	DecisionMean = "mean"
	// DecisionMedian means use the median average of predicted values
	DecisionMedian = "median"
)
View Source
const (
	// P90LatencySLIType is the name of the SLO that is used for the 90th percentile latency
	P90LatencySLIType = "p90-latency"
	// P95LatencySLIType is the name of the SLO that is used for the 95th percentile latency
	P95LatencySLIType = "p95-latency"
	// P99LatencySLIType is the name of the SLO that is used for the 99th percentile latency
	P99LatencySLIType = "p99-latency"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Models                  []*Model                   `json:"models"`
	Metrics                 []autoscalingv2.MetricSpec `json:"metrics"`
	SLO                     []*SLO                     `json:"slo"`
	DecisionType            string                     `json:"decisionType"`
	DBPath                  string                     `json:"dbPath"`
	MigrationPath           string                     `json:"migrationPath"`
	ServiceName             string                     `json:"serviceName"`
	Namespace               string                     `json:"namespace"`
	Tolerance               float64                    `json:"tolerance"`
	CPUInitializationPeriod int                        `json:"cpuInitializationPeriod"`
	InitialReadinessDelay   int                        `json:"initialReadinessDelay"`
}

Config holds the configuration of the Predictive element of the PHPA

func LoadConfig

func LoadConfig(configEnv io.Reader) (*Config, error)

LoadConfig takes in the predictive config as a byte array and uses it to build the config, overriding default values

type HoltWinters

type HoltWinters struct {
	Alpha                  *float64         `json:"alpha"`
	Beta                   *float64         `json:"beta"`
	Gamma                  *float64         `json:"gamma"`
	Trend                  string           `json:"trend"`
	Seasonal               string           `json:"seasonal"`
	SeasonalPeriods        int              `json:"seasonalPeriods"`
	StoredSeasons          int              `json:"storedSeasons"`
	DampedTrend            *bool            `json:"dampedTrend"`
	InitializationMethod   *string          `json:"initializationMethod"`
	InitialLevel           *float64         `json:"initialLevel"`
	InitialTrend           *float64         `json:"initialTrend"`
	InitialSeasonal        *float64         `json:"initialSeasonal"`
	RuntimeTuningFetchHook *hook.Definition `json:"runtimeTuningFetchHook"`
}

HoltWinters represents a holt-winters exponential smoothing prediction model configuration

type Linear

type Linear struct {
	StoredValues int `json:"storedValues"`
	LookAhead    int `json:"lookAhead"`
}

Linear represents a linear regression prediction model configuration

type Model

type Model struct {
	Type               string       `json:"type"`
	Name               string       `json:"name"`
	PerInterval        int          `json:"perInterval"`
	CalculationTimeout *int         `json:"calculationTimeout"`
	Linear             *Linear      `json:"linear"`
	HoltWinters        *HoltWinters `json:"holtWinters"`
}

Model represents a prediction model to use, e.g. a linear regression

type SLO

type SLO struct {
	Type                     string  `json:"type"`
	Name                     string  `json:"name"`
	ObjectiveValue           float64 `json:"objectiveValue"`
	ReplicaOffsetOnViolation int32   `json:"replicaOffsetOnViolation"`
}

SLO represents a service level objective defined by yaml

Jump to

Keyboard shortcuts

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