custom-pod-autoscaler: Index | Files

package config

import ""

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.


Package Files



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"

type APIConfig Uses

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 Uses

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

Config is the configuration options for the CPA

func LoadConfig Uses

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 Uses

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 Uses

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 Uses

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

Shell describes configuration options for a shell command method

Package config imports 6 packages (graph) and is imported by 9 packages. Updated 2020-07-07. Refresh now. Tools for package owners.