config

package
v2.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package config contains the definitions for any configuration that the Custom Pod Autoscaler supports. This configuration defines any option that can be configured on a Custom Pod Autoscaler.

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"
)
View Source
const (
	// APIRunType marks the metric gathering/evaluation as running during an API request, which will use the results to
	// scale
	APIRunType = "api"
	// APIDryRunRunType marks the metric gathering/evaluation as running during an API request, which will only view
	// the results and not use it for scaling
	APIDryRunRunType = "api_dry_run"
	// ScalerRunType marks the metric gathering/evaluation as running during a scale
	ScalerRunType = "scaler"
)
View Source
const (
	// DefaultInterval is the default interval value
	DefaultInterval = 15000
	// DefaultNamespace is the default namespace value
	DefaultNamespace = "default"
	// DefaultMinReplicas is the default minimum replica count
	DefaultMinReplicas = 1
	// DefaultMaxReplicas is the default maximum replica count
	DefaultMaxReplicas = 10
	// DefaultStartTime is the default start time
	DefaultStartTime = 1
	// DefaultRunMode is the default run mode
	DefaultRunMode = PerPodRunMode
	// DefaultLogVerbosity is the default log verbosity
	DefaultLogVerbosity = 0
	// DefaultDownscaleStabilization is the default downscale stabilization value
	DefaultDownscaleStabilization = 0
	// DefaultCPUInitializationPeriod is the default CPU initialization value
	DefaultCPUInitializationPeriod = 300
	// DefaultInitialReadinessDelay is the default initial readiness delay value
	DefaultInitialReadinessDelay = 30
)
View Source
const (
	// DefaultAPIEnabled is the default value for the API being enabled
	DefaultAPIEnabled = true
	// DefaultUseHTTPS is the default value for the API using HTTPS
	DefaultUseHTTPS = false
	// DefaultHost is the default address for the API
	DefaultHost = "0.0.0.0"
	// DefaultPort is the default port for the API
	DefaultPort = 5000
	// DefaultCertFile is the default cert file for the API
	DefaultCertFile = ""
	// DefaultKeyFile is the default private key file for the API
	DefaultKeyFile = ""
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIConfig

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    []K8sMetricSpec                          `json:"kubernetesMetricSpecs"`
	RequireKubernetesMetrics bool                                     `json:"requireKubernetesMetrics"`
	InitialReadinessDelay    int64                                    `json:"initialReadinessDelay"`
	CPUInitializationPeriod  int64                                    `json:"cpuInitializationPeriod"`
}

Config is the configuration options for the CPA

func NewConfig

func NewConfig() *Config

NewConfig returns a config set up with all default values

type HTTP

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"`
	CACert        *string           `json:"caCert"`
	ClientCert    *string           `json:"clientCert"`
	ClientKey     *string           `json:"clientKey"`
}

HTTP describes configuration options for an HTTP request method

type K8sExternalMetricSource

type K8sExternalMetricSource autoscalingv2.ExternalMetricSource

K8sExternalMetricSource defines gathering metrics for a metric not associated with any Kubernetes object (for example length of queue in cloud messaging service, or QPS from loadbalancer running outside of cluster).

type K8sMetricSpec

type K8sMetricSpec autoscalingv2.MetricSpec

K8sMetricSpec defines which metrics to query from the metrics server

type K8sMetricTarget

type K8sMetricTarget autoscalingv2.MetricTarget

K8sMetricTarget defines the type of metric gathering, either target value, average value, or average utilization of a specific metric

type K8sObjectMetricSource

type K8sObjectMetricSource autoscalingv2.ObjectMetricSource

K8sObjectMetricSource defines gathering metrics for a kubernetes object (for example, hits-per-second on an Ingress object).

type K8sPodsMetricSource

type K8sPodsMetricSource autoscalingv2.PodsMetricSource

K8sPodsMetricSource defines gathering metrics describing each pod in the current scale target (for example, transactions-processed-per-second).

type K8sResourceMetricSource

type K8sResourceMetricSource autoscalingv2.ResourceMetricSource

K8sResourceMetricSource defines gathering metrics for a resource metric known to Kubernetes, as specified in requests and limits, describing each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes.

type Method

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

type Shell struct {
	Command    []string `json:"command"`
	Entrypoint string   `json:"entrypoint"`
	LogStderr  *bool    `json:"logStderr,omitempty"`
}

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