config

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package config handles parsing YAML and environment variable input into a Custom Pod Autoscaler configuration file. Contains a set of defaults that can be overridden by provided YAML and env vars.

Index

Constants

View Source
const (
	// PerPodRunMode runs metric gathering per Pod, individually running the script for each Pod being managed
	// with the Pod information piped into the metric gathering script
	PerPodRunMode = "per-pod"
	// PerResourceRunMode runs metric gathering per Resource, running the script only once for the resource
	// being managed, with the resource information piped into the metric gathering script
	PerResourceRunMode = "per-resource"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIConfig added in v0.10.0

type APIConfig struct {
	Enabled  bool   `json:"enabled"`
	UseHTTPS bool   `json:"useHTTPS"`
	Port     int    `json:"port"`
	Host     string `json:"host"`
	CertFile string `json:"certFile"`
	KeyFile  string `json:"keyFile"`
}

APIConfig is configuration options specifically for the API exposed by the CPA

type Config

type Config struct {
	ScaleTargetRef           *autoscaling.CrossVersionObjectReference `json:"scaleTargetRef"`
	PreMetric                *Method                                  `json:"preMetric"`
	PostMetric               *Method                                  `json:"postMetric"`
	PreEvaluate              *Method                                  `json:"preEvaluate"`
	PostEvaluate             *Method                                  `json:"postEvaluate"`
	PreScale                 *Method                                  `json:"preScale"`
	PostScale                *Method                                  `json:"postScale"`
	Evaluate                 *Method                                  `json:"evaluate"`
	Metric                   *Method                                  `json:"metric"`
	Interval                 int                                      `json:"interval"`
	Namespace                string                                   `json:"namespace"`
	MinReplicas              int32                                    `json:"minReplicas"`
	MaxReplicas              int32                                    `json:"maxReplicas"`
	RunMode                  string                                   `json:"runMode"`
	StartTime                int64                                    `json:"startTime"`
	LogVerbosity             int32                                    `json:"logVerbosity"`
	DownscaleStabilization   int                                      `json:"downscaleStabilization"`
	APIConfig                *APIConfig                               `json:"apiConfig"`
	KubernetesMetricSpecs    []measure.MetricSpec                     `json:"kubernetesMetricSpecs"`
	RequireKubernetesMetrics bool                                     `json:"requireKubernetesMetrics"`
	InitialReadinessDelay    int64                                    `json:"initialReadinessDelay"`
	CPUInitializationPeriod  int64                                    `json:"cpuInitializationPeriod"`
}

Config is the configuration options for the CPA

func LoadConfig

func LoadConfig(configFileData []byte, envVars map[string]string) (*Config, error)

LoadConfig loads in the default configuration, then overrides it from the config file, then any env vars set.

type HTTP added in v0.13.0

type HTTP struct {
	Method        string            `json:"method"`
	URL           string            `json:"url"`
	Headers       map[string]string `json:"headers,omitempty"`
	SuccessCodes  []int             `json:"successCodes"`
	ParameterMode string            `json:"parameterMode"`
}

HTTP describes configuration options for an HTTP request method

type Method added in v0.8.0

type Method struct {
	Type    string `json:"type"`
	Timeout int    `json:"timeout"`
	Shell   *Shell `json:"shell"`
	HTTP    *HTTP  `json:"http"`
}

Method describes a method for passing data/triggerering logic, such as through a shell command

type Shell added in v0.9.0

type Shell struct {
	Command    []string `json:"command"`
	Entrypoint string   `json:"entrypoint"`
}

Shell describes configuration options for a shell command method

Jump to

Keyboard shortcuts

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