Documentation ¶
Index ¶
Constants ¶
const ( AnnotationTargetContainerName = namespace + "/target-container-name" AnnotationCpuStartup = namespace + "/cpu-startup" AnnotationCpuPostStartupRequests = namespace + "/cpu-post-startup-requests" AnnotationCpuPostStartupLimits = namespace + "/cpu-post-startup-limits" AnnotationMemoryStartup = namespace + "/memory-startup" AnnotationMemoryPostStartupRequests = namespace + "/memory-post-startup-requests" AnnotationMemoryPostStartupLimits = namespace + "/memory-post-startup-limits" )
const (
AnnotationStatus = namespace + "/status"
)
const (
LabelEnabled = namespace + "/enabled"
)
Variables ¶
var KnownVpaAnnotations = []string{"vpaObservedContainers", "vpaUpdates"}
Functions ¶
This section is empty.
Types ¶
type CpuConfig ¶
type CpuConfig struct { Startup resource.Quantity PostStartupRequests resource.Quantity PostStartupLimits resource.Quantity }
CpuConfig holds CPU configuration.
type MemoryConfig ¶
type MemoryConfig struct { Startup resource.Quantity PostStartupRequests resource.Quantity PostStartupLimits resource.Quantity }
MemoryConfig holds memory configuration.
func NewMemoryConfig ¶
type ScaleConfig ¶
type ScaleConfig interface { GetTargetContainerName() string GetCpuConfig() CpuConfig GetMemoryConfig() MemoryConfig StoreFromAnnotations(*v1.Pod) error Validate() error String() string }
ScaleConfig performs operations relating to scaling configuration.
type StateContainer ¶
type StateContainer string
StateContainer indicates the state of a Kube container.
const ( StateContainerRunning StateContainer = "running" StateContainerWaiting StateContainer = "waiting" StateContainerTerminated StateContainer = "terminated" StateContainerUnknown StateContainer = "unknown" )
type StateResources ¶
type StateResources string
StateResources indicates what Kube container resources are set.
const ( StateResourcesStartup StateResources = "startup" StateResourcesPostStartup StateResources = "poststartup" StateResourcesUnknown StateResources = "unknown" )
func (StateResources) Direction ¶
func (s StateResources) Direction() metricscommon.Direction
Direction returns the scale direction.
func (StateResources) HumanReadable ¶
func (s StateResources) HumanReadable() string
HumanReadable returns a string suitable to include within human-readable messages.
type StateStatusResources ¶
type StateStatusResources string
StateStatusResources indicates the state of a Kube container's status resources.
const ( // StateStatusResourcesIncomplete indicates status resources are incomplete. StateStatusResourcesIncomplete StateStatusResources = "incomplete" // StateStatusResourcesContainerResourcesMatch indicates status resources match container resources. StateStatusResourcesContainerResourcesMatch StateStatusResources = "containerresourcesmatch" // StateStatusResourcesContainerResourcesMismatch indicates status resources don't match container resources. StateStatusResourcesContainerResourcesMismatch StateStatusResources = "containerresourcesmismatch" // StateStatusResourcesUnknown indicates status resources are unknown. StateStatusResourcesUnknown StateStatusResources = "unknown" )
type States ¶
type States struct { StartupProbe StateBool `json:"startupProbe"` ReadinessProbe StateBool `json:"readinessProbe"` Container StateContainer `json:"container"` Started StateBool `json:"started"` Ready StateBool `json:"ready"` Resources StateResources `json:"resources"` StatusResources StateStatusResources `json:"statusResources"` }
States holds information related to the current state of the target container.
func NewStates ¶
func NewStates( startupProbe StateBool, readinessProbe StateBool, stateContainer StateContainer, started StateBool, ready StateBool, stateResources StateResources, stateStatusResources StateStatusResources, ) States
func NewStatesAllUnknown ¶
func NewStatesAllUnknown() States
type StatusAnnotation ¶
type StatusAnnotation struct { Status string `json:"status"` States States `json:"states"` Scale StatusAnnotationScale `json:"scale"` LastUpdated string `json:"lastUpdated"` }
StatusAnnotation holds status information that's serialized to JSON for status reporting.
func NewStatusAnnotation ¶
func NewStatusAnnotation( status string, states States, scale StatusAnnotationScale, lastUpdated string, ) StatusAnnotation
func StatusAnnotationFromString ¶
func StatusAnnotationFromString(s string) (StatusAnnotation, error)
StatusAnnotationFromString returns a status annotation from s.
func (StatusAnnotation) Equal ¶
func (s StatusAnnotation) Equal(to StatusAnnotation) bool
Equal reports whether this is to equal to another.
type StatusAnnotationScale ¶
type StatusAnnotationScale struct { LastCommanded string `json:"lastCommanded"` LastEnacted string `json:"lastEnacted"` LastFailed string `json:"lastFailed"` }
StatusAnnotationScale holds scale-related information that's serialized to JSON for status reporting.
func NewEmptyStatusAnnotationScale ¶
func NewEmptyStatusAnnotationScale() StatusAnnotationScale
func NewStatusAnnotationScale ¶
func NewStatusAnnotationScale( lastCommanded string, lastEnacted string, lastFailed string, ) StatusAnnotationScale
type StatusScaleState ¶
type StatusScaleState string
StatusScaleState indicates the scale state for status purposes.
const ( // StatusScaleStateNotApplicable indicates the scale state is not applicable. StatusScaleStateNotApplicable StatusScaleState = "notapplicable" // StatusScaleStateUpCommanded indicates scaling up commanded. StatusScaleStateUpCommanded StatusScaleState = "upcommanded" // StatusScaleStateUpEnacted indicates scaling up enacted. StatusScaleStateUpEnacted StatusScaleState = "upenacted" // StatusScaleStateUpFailed indicates scaling up failed. StatusScaleStateUpFailed StatusScaleState = "upfailed" // StatusScaleStateDownCommanded indicates scaling down commanded. StatusScaleStateDownCommanded StatusScaleState = "downcommanded" // StatusScaleStateDownEnacted indicates scaling down enacted. StatusScaleStateDownEnacted StatusScaleState = "downenacted" // StatusScaleStateDownFailed indicates scaling down failed. StatusScaleStateDownFailed StatusScaleState = "downfailed" // StatusScaleStateUnknownCommanded indicates scaling in an unknown direction commanded. StatusScaleStateUnknownCommanded StatusScaleState = "unknowncommanded" )
func (StatusScaleState) Direction ¶
func (s StatusScaleState) Direction() metricscommon.Direction
Direction returns the scale direction.