userconfig

package
v0.42.1 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// API
	NameKey           = "name"
	KindKey           = "kind"
	NetworkingKey     = "networking"
	ComputeKey        = "compute"
	AutoscalingKey    = "autoscaling"
	UpdateStrategyKey = "update_strategy"

	// TrafficSplitter
	APIsKey   = "apis"
	WeightKey = "weight"
	ShadowKey = "shadow"

	// Pod
	PodKey            = "pod"
	NodeGroupsKey     = "node_groups"
	PortKey           = "port"
	MaxConcurrencyKey = "max_concurrency"
	MaxQueueLengthKey = "max_queue_length"
	ContainersKey     = "containers"

	// Containers
	ContainerNameKey  = "name"
	ImageKey          = "image"
	EnvKey            = "env"
	CommandKey        = "command"
	ArgsKey           = "args"
	ReadinessProbeKey = "readiness_probe"
	LivenessProbeKey  = "liveness_probe"
	PreStopKey        = "pre_stop"

	// Probe
	HTTPGetKey             = "http_get"
	TCPSocketKey           = "tcp_socket"
	ExecKey                = "exec"
	InitialDelaySecondsKey = "initial_delay_seconds"
	TimeoutSecondsKey      = "timeout_seconds"
	PeriodSecondsKey       = "period_seconds"
	SuccessThresholdKey    = "success_threshold"
	FailureThresholdKey    = "failure_threshold"

	// Probe types
	PathKey = "path"

	// Compute
	CPUKey = "cpu"
	MemKey = "mem"
	GPUKey = "gpu"
	InfKey = "inf"
	ShmKey = "shm"

	// Networking
	EndpointKey = "endpoint"

	// Autoscaling
	MinReplicasKey                  = "min_replicas"
	MaxReplicasKey                  = "max_replicas"
	InitReplicasKey                 = "init_replicas"
	TargetInFlightKey               = "target_in_flight"
	WindowKey                       = "window"
	DownscaleStabilizationPeriodKey = "downscale_stabilization_period"
	UpscaleStabilizationPeriodKey   = "upscale_stabilization_period"
	MaxDownscaleFactorKey           = "max_downscale_factor"
	MaxUpscaleFactorKey             = "max_upscale_factor"
	DownscaleToleranceKey           = "downscale_tolerance"
	UpscaleToleranceKey             = "upscale_tolerance"

	// UpdateStrategy
	MaxSurgeKey       = "max_surge"
	MaxUnavailableKey = "max_unavailable"

	// K8s annotation
	EndpointAnnotationKey                     = "networking.cortex.dev/endpoint"
	MaxConcurrencyAnnotationKey               = "pod.cortex.dev/max-concurrency"
	MaxQueueLengthAnnotationKey               = "pod.cortex.dev/max-queue-length"
	NumTrafficSplitterTargetsAnnotationKey    = "apis.cortex.dev/traffic-splitter-targets"
	MinReplicasAnnotationKey                  = "autoscaling.cortex.dev/min-replicas"
	MaxReplicasAnnotationKey                  = "autoscaling.cortex.dev/max-replicas"
	TargetInFlightAnnotationKey               = "autoscaling.cortex.dev/target-in-flight"
	WindowAnnotationKey                       = "autoscaling.cortex.dev/window"
	DownscaleStabilizationPeriodAnnotationKey = "autoscaling.cortex.dev/downscale-stabilization-period"
	UpscaleStabilizationPeriodAnnotationKey   = "autoscaling.cortex.dev/upscale-stabilization-period"
	MaxDownscaleFactorAnnotationKey           = "autoscaling.cortex.dev/max-downscale-factor"
	MaxUpscaleFactorAnnotationKey             = "autoscaling.cortex.dev/max-upscale-factor"
	DownscaleToleranceAnnotationKey           = "autoscaling.cortex.dev/downscale-tolerance"
	UpscaleToleranceAnnotationKey             = "autoscaling.cortex.dev/upscale-tolerance"
)

Variables

This section is empty.

Functions

func ConcurrencyFromAnnotations added in v0.40.0

func ConcurrencyFromAnnotations(k8sObj kmeta.Object) (int, int, error)

func EndpointFromAnnotation added in v0.40.0

func EndpointFromAnnotation(k8sObj kmeta.Object) (string, error)

func GetContainerNames added in v0.36.0

func GetContainerNames(containers []*Container) strset.Set

func IdentifyAPI

func IdentifyAPI(filePath string, name string, kind Kind, index int) string

func KindStrings added in v0.19.0

func KindStrings() []string

func LogLevelTypes added in v0.26.0

func LogLevelTypes() []string

func ToZapLogLevel added in v0.27.0

func ToZapLogLevel(logLevel LogLevel) zapcore.Level

func TrafficSplitterTargetsFromAnnotations added in v0.40.0

func TrafficSplitterTargetsFromAnnotations(k8sObj kmeta.Object) (int32, error)

Types

type API

type API struct {
	Resource

	Pod              *Pod            `json:"pod" yaml:"pod"`
	NodeGroups       []string        `json:"node_groups" yaml:"node_groups"`
	APIs             []*TrafficSplit `json:"apis" yaml:"apis"`
	Networking       *Networking     `json:"networking" yaml:"networking"`
	Autoscaling      *Autoscaling    `json:"autoscaling" yaml:"autoscaling"`
	UpdateStrategy   *UpdateStrategy `json:"update_strategy" yaml:"update_strategy"`
	Index            int             `json:"index" yaml:"-"`
	FileName         string          `json:"file_name" yaml:"-"`
	SubmittedAPISpec interface{}     `json:"submitted_api_spec" yaml:"submitted_api_spec"`
}

func (*API) Identify

func (api *API) Identify() string

func (*API) TelemetryEvent added in v0.23.0

func (api *API) TelemetryEvent() map[string]interface{}

func (*API) ToK8sAnnotations added in v0.18.0

func (api *API) ToK8sAnnotations() map[string]string

InitReplicas was left out deliberately

func (*API) UserStr

func (api *API) UserStr() string

type Autoscaling added in v0.14.0

type Autoscaling struct {
	MinReplicas                  int32         `json:"min_replicas" yaml:"min_replicas"`
	MaxReplicas                  int32         `json:"max_replicas" yaml:"max_replicas"`
	InitReplicas                 int32         `json:"init_replicas" yaml:"init_replicas"`
	TargetInFlight               *float64      `json:"target_in_flight" yaml:"target_in_flight"`
	Window                       time.Duration `json:"window" yaml:"window"`
	DownscaleStabilizationPeriod time.Duration `json:"downscale_stabilization_period" yaml:"downscale_stabilization_period"`
	UpscaleStabilizationPeriod   time.Duration `json:"upscale_stabilization_period" yaml:"upscale_stabilization_period"`
	MaxDownscaleFactor           float64       `json:"max_downscale_factor" yaml:"max_downscale_factor"`
	MaxUpscaleFactor             float64       `json:"max_upscale_factor" yaml:"max_upscale_factor"`
	DownscaleTolerance           float64       `json:"downscale_tolerance" yaml:"downscale_tolerance"`
	UpscaleTolerance             float64       `json:"upscale_tolerance" yaml:"upscale_tolerance"`
}

func AutoscalingFromAnnotations added in v0.14.0

func AutoscalingFromAnnotations(k8sObj kmeta.Object) (*Autoscaling, error)

func (*Autoscaling) UserStr added in v0.14.0

func (autoscaling *Autoscaling) UserStr() string

type Compute

type Compute struct {
	CPU *k8s.Quantity `json:"cpu" yaml:"cpu"`
	Mem *k8s.Quantity `json:"mem" yaml:"mem"`
	GPU int64         `json:"gpu" yaml:"gpu"`
	Inf int64         `json:"inf" yaml:"inf"`
	Shm *k8s.Quantity `json:"shm" yaml:"shm"`
}

func GetPodComputeRequest added in v0.37.0

func GetPodComputeRequest(api *API) Compute

func ZeroCompute added in v0.19.0

func ZeroCompute() Compute

func (*Compute) UserStr

func (compute *Compute) UserStr() string

type Container added in v0.36.0

type Container struct {
	Name  string            `json:"name" yaml:"name"`
	Image string            `json:"image" yaml:"image"`
	Env   map[string]string `json:"env" yaml:"env"`

	Command []string `json:"command" yaml:"command"`
	Args    []string `json:"args" yaml:"args"`

	ReadinessProbe *Probe   `json:"readiness_probe" yaml:"readiness_probe"`
	LivenessProbe  *Probe   `json:"liveness_probe" yaml:"liveness_probe"`
	PreStop        *PreStop `json:"pre_stop" yaml:"pre_stop"`

	Compute *Compute `json:"compute" yaml:"compute"`
}

func (*Container) UserStr added in v0.36.0

func (container *Container) UserStr() string

type ExecHandler added in v0.41.0

type ExecHandler struct {
	Command []string `json:"command" yaml:"command"`
}

func (*ExecHandler) UserStr added in v0.41.0

func (execHandler *ExecHandler) UserStr() string

type HTTPGetHandler added in v0.41.0

type HTTPGetHandler struct {
	Path string `json:"path" yaml:"path"`
	Port int32  `json:"port" yaml:"port"`
}

func (*HTTPGetHandler) UserStr added in v0.41.0

func (httpHandler *HTTPGetHandler) UserStr() string

type Kind added in v0.19.0

type Kind int
const (
	UnknownKind Kind = iota
	RealtimeAPIKind
	BatchAPIKind
	TrafficSplitterKind
	TaskAPIKind
	AsyncAPIKind
)

func KindFromString added in v0.19.0

func KindFromString(s string) Kind

func (Kind) MarshalBinary added in v0.19.0

func (t Kind) MarshalBinary() ([]byte, error)

MarshalBinary satisfies BinaryMarshaler

func (Kind) MarshalText added in v0.19.0

func (t Kind) MarshalText() ([]byte, error)

MarshalText satisfies TextMarshaler

func (Kind) String added in v0.19.0

func (t Kind) String() string

func (*Kind) UnmarshalBinary added in v0.19.0

func (t *Kind) UnmarshalBinary(data []byte) error

UnmarshalBinary satisfies BinaryUnmarshaler Needed for msgpack

func (*Kind) UnmarshalText added in v0.19.0

func (t *Kind) UnmarshalText(text []byte) error

UnmarshalText satisfies TextUnmarshaler

type LogLevel added in v0.26.0

type LogLevel int
const (
	UnknownLogLevel LogLevel = iota
	DebugLogLevel
	InfoLogLevel
	WarningLogLevel
	ErrorLogLevel
)

func LogLevelFromString added in v0.26.0

func LogLevelFromString(s string) LogLevel

func (LogLevel) MarshalBinary added in v0.26.0

func (t LogLevel) MarshalBinary() ([]byte, error)

MarshalBinary satisfies BinaryMarshaler

func (LogLevel) MarshalText added in v0.26.0

func (t LogLevel) MarshalText() ([]byte, error)

MarshalText satisfies TextMarshaler

func (LogLevel) String added in v0.26.0

func (t LogLevel) String() string

func (*LogLevel) UnmarshalBinary added in v0.26.0

func (t *LogLevel) UnmarshalBinary(data []byte) error

UnmarshalBinary satisfies BinaryUnmarshaler Needed for msgpack

func (*LogLevel) UnmarshalText added in v0.26.0

func (t *LogLevel) UnmarshalText(text []byte) error

UnmarshalText satisfies TextUnmarshaler

type Networking added in v0.18.0

type Networking struct {
	Endpoint *string `json:"endpoint" yaml:"endpoint"`
}

func (*Networking) UserStr added in v0.18.0

func (networking *Networking) UserStr() string

type Pod added in v0.36.0

type Pod struct {
	Port           *int32       `json:"port" yaml:"port"`
	MaxQueueLength int64        `json:"max_queue_length" yaml:"max_queue_length"`
	MaxConcurrency int64        `json:"max_concurrency" yaml:"max_concurrency"`
	Containers     []*Container `json:"containers" yaml:"containers"`
}

func (*Pod) UserStr added in v0.36.0

func (pod *Pod) UserStr(kind Kind) string

type PreStop added in v0.41.0

type PreStop struct {
	HTTPGet *HTTPGetHandler `json:"http_get" yaml:"http_get"`
	Exec    *ExecHandler    `json:"exec" yaml:"exec"`
}

func (*PreStop) UserStr added in v0.41.0

func (preStop *PreStop) UserStr() string

type Probe added in v0.36.0

type Probe struct {
	HTTPGet             *HTTPGetHandler   `json:"http_get" yaml:"http_get"`
	TCPSocket           *TCPSocketHandler `json:"tcp_socket" yaml:"tcp_socket"`
	Exec                *ExecHandler      `json:"exec" yaml:"exec"`
	InitialDelaySeconds int32             `json:"initial_delay_seconds" yaml:"initial_delay_seconds"`
	TimeoutSeconds      int32             `json:"timeout_seconds" yaml:"timeout_seconds"`
	PeriodSeconds       int32             `json:"period_seconds" yaml:"period_seconds"`
	SuccessThreshold    int32             `json:"success_threshold" yaml:"success_threshold"`
	FailureThreshold    int32             `json:"failure_threshold" yaml:"failure_threshold"`
}

func (*Probe) UserStr added in v0.36.0

func (probe *Probe) UserStr() string

type Resource added in v0.19.0

type Resource struct {
	Name string `json:"name" yaml:"name"`
	Kind Kind   `json:"kind" yaml:"kind"`
}

func (Resource) UserString added in v0.19.0

func (r Resource) UserString() string

type TCPSocketHandler added in v0.41.0

type TCPSocketHandler struct {
	Port int32 `json:"port" yaml:"port"`
}

func (*TCPSocketHandler) UserStr added in v0.41.0

func (tcpSocketHandler *TCPSocketHandler) UserStr() string

type TrafficSplit added in v0.19.0

type TrafficSplit struct {
	Name   string `json:"name" yaml:"name"`
	Weight int32  `json:"weight" yaml:"weight"`
	Shadow bool   `json:"shadow" yaml:"shadow"`
}

func (*TrafficSplit) UserStr added in v0.19.0

func (trafficSplit *TrafficSplit) UserStr() string

type UpdateStrategy added in v0.14.0

type UpdateStrategy struct {
	MaxSurge       string `json:"max_surge" yaml:"max_surge"`
	MaxUnavailable string `json:"max_unavailable" yaml:"max_unavailable"`
}

func (*UpdateStrategy) UserStr added in v0.14.0

func (updateStrategy *UpdateStrategy) UserStr() string

Jump to

Keyboard shortcuts

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