Back to godoc.org

Package config

v0.5.0
Latest Go to latest

The latest major version is .

Published: Mar 27, 2020 | License: Apache-2.0 | Module: github.com/jthomperoo/predictive-horizontal-pod-autoscaler

Overview

Package config provides configuration options for the Predictive Horizontal Pod Autoscaler

Index

Constants

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

type Config

type Config struct {
	Models                  []*Model                   `json:"models"`
	Metrics                 []autoscalingv2.MetricSpec `json:"metrics"`
	DecisionType            string                     `json:"decisionType"`
	DBPath                  string                     `json:"dbPath"`
	MigrationPath           string                     `json:"migrationPath"`
	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"`
	SeasonLength  int     `json:"seasonLength"`
	StoredSeasons int     `json:"storedSeasons"`
	Method        string  `json:"method"`
}

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"`
	Linear      *Linear      `json:"linear"`
	HoltWinters *HoltWinters `json:"holtWinters"`
}

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

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier