Documentation ¶
Index ¶
- type ActionMonitorDownscale
- type ActionMonitorUpscale
- type ActionNeonVMRequest
- type ActionPluginRequest
- type ActionSet
- type ActionWait
- type Config
- type LogConfig
- type Metrics
- type MonitorHandle
- func (h MonitorHandle) Active(active bool)
- func (h MonitorHandle) DownscaleRequestAllowed(now time.Time)
- func (h MonitorHandle) DownscaleRequestDenied(now time.Time)
- func (h MonitorHandle) DownscaleRequestFailed(now time.Time)
- func (h MonitorHandle) Reset()
- func (h MonitorHandle) StartingDownscaleRequest(now time.Time, resources api.Resources)
- func (h MonitorHandle) StartingUpscaleRequest(now time.Time, resources api.Resources)
- func (h MonitorHandle) UpscaleRequestFailed(now time.Time)
- func (h MonitorHandle) UpscaleRequestSuccessful(now time.Time)
- func (h MonitorHandle) UpscaleRequested(now time.Time, resources api.MoreResources)
- type NeonVMHandle
- type PluginHandle
- type State
- func (s *State) Debug(enabled bool)
- func (s *State) DesiredResourcesFromMetricsOrRequestedUpscaling(now time.Time) (api.Resources, func(ActionSet) *time.Duration)
- func (s *State) Dump() StateDump
- func (s *State) Monitor() MonitorHandle
- func (s *State) NeonVM() NeonVMHandle
- func (s *State) NextActions(now time.Time) ActionSet
- func (s *State) Plugin() PluginHandle
- func (s *State) UpdateMetrics(metrics Metrics)
- func (s *State) UpdatedVM(vm api.VmInfo)
- type StateDump
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionMonitorDownscale ¶
type ActionMonitorDownscale struct { Current api.Resources `json:"current"` Target api.Resources `json:"target"` }
func (ActionMonitorDownscale) MarshalLogObject ¶ added in v0.18.1
func (a ActionMonitorDownscale) MarshalLogObject(enc zapcore.ObjectEncoder) error
MarshalLogObject implements zapcore.ObjectMarshaler, so that ActionMonitorDownscale can be used with zap.Object
type ActionMonitorUpscale ¶
type ActionMonitorUpscale struct { Current api.Resources `json:"current"` Target api.Resources `json:"target"` }
func (ActionMonitorUpscale) MarshalLogObject ¶ added in v0.18.1
func (a ActionMonitorUpscale) MarshalLogObject(enc zapcore.ObjectEncoder) error
MarshalLogObject implements zapcore.ObjectMarshaler, so that ActionMonitorUpscale can be used with zap.Object
type ActionNeonVMRequest ¶
type ActionNeonVMRequest struct { Current api.Resources `json:"current"` Target api.Resources `json:"target"` }
func (ActionNeonVMRequest) MarshalLogObject ¶ added in v0.18.1
func (a ActionNeonVMRequest) MarshalLogObject(enc zapcore.ObjectEncoder) error
MarshalLogObject implements zapcore.ObjectMarshaler, so that ActionNeonVMRequest can be used with zap.Object
type ActionPluginRequest ¶
type ActionPluginRequest struct { LastPermit *api.Resources `json:"current"` Target api.Resources `json:"target"` Metrics *api.Metrics `json:"metrics"` }
func (ActionPluginRequest) MarshalLogObject ¶ added in v0.18.1
func (a ActionPluginRequest) MarshalLogObject(enc zapcore.ObjectEncoder) error
MarshalLogObject implements zapcore.ObjectMarshaler, so that ActionPluginRequest can be used with zap.Object
type ActionSet ¶
type ActionSet struct { Wait *ActionWait `json:"wait,omitempty"` PluginRequest *ActionPluginRequest `json:"pluginRequest,omitempty"` NeonVMRequest *ActionNeonVMRequest `json:"neonvmRequest,omitempty"` MonitorDownscale *ActionMonitorDownscale `json:"monitorDownscale,omitempty"` MonitorUpscale *ActionMonitorUpscale `json:"monitorUpscale,omitempty"` }
func (ActionSet) MarshalLogObject ¶ added in v0.18.1
func (s ActionSet) MarshalLogObject(enc zapcore.ObjectEncoder) error
type ActionWait ¶
func (ActionWait) MarshalLogObject ¶ added in v0.18.1
func (a ActionWait) MarshalLogObject(enc zapcore.ObjectEncoder) error
MarshalLogObject implements zapcore.ObjectMarshaler, so that ActionWait can be used with zap.Object
type Config ¶
type Config struct { // ComputeUnit is the desired ratio between CPU and memory, copied from the global // autoscaler-agent config. ComputeUnit api.Resources // DefaultScalingConfig is just copied from the global autoscaler-agent config. // If the VM's ScalingConfig is nil, we use this field instead. DefaultScalingConfig api.ScalingConfig // NeonVMRetryWait gives the amount of time to wait to retry after a failed request NeonVMRetryWait time.Duration // PluginRequestTick gives the period at which we should be making requests to the scheduler // plugin, even if nothing's changed. PluginRequestTick time.Duration // PluginRetryWait gives the amount of time to wait to retry after a failed request PluginRetryWait time.Duration // PluginDeniedRetryWait gives the amount of time we must wait before re-requesting resources // that were not fully granted. PluginDeniedRetryWait time.Duration // MonitorDeniedDownscaleCooldown gives the time we must wait between making duplicate // downscale requests to the vm-monitor where the previous failed. MonitorDeniedDownscaleCooldown time.Duration // MonitorRequestedUpscaleValidPeriod gives the duration for which requested upscaling from the // vm-monitor must be respected. MonitorRequestedUpscaleValidPeriod time.Duration // MonitorRetryWait gives the amount of time to wait to retry after a *failed* request. MonitorRetryWait time.Duration // Log provides an outlet for (*State).NextActions() to give informative messages or warnings // about conditions that are impeding its ability to execute. Log LogConfig `json:"-"` }
Config represents some of the static configuration underlying the decision-making of State
type LogConfig ¶
type LogConfig struct { // Info, if not nil, will be called to provide information during normal functioning. // For example, we log the calculated desired resources on every call to NextActions. Info func(string, ...zap.Field) // Warn, if not nil, will be called to log conditions that are impeding the ability to move the // current resources to what's desired. // A typical warning may be something like "wanted to do X but couldn't because of Y". Warn func(string, ...zap.Field) }
type Metrics ¶ added in v0.28.0
func ReadMetrics ¶ added in v0.28.0
ReadMetrics generates Metrics from vector.dev's host metrics output, or returns error on failure
This function could be more efficient, but realistically it doesn't matter. The size of the output from node_exporter/vector is so small anyways.
type MonitorHandle ¶
type MonitorHandle struct {
// contains filtered or unexported fields
}
MonitorHandle provides write access to the vm-monitor pieces of an UpdateState
func (MonitorHandle) Active ¶
func (h MonitorHandle) Active(active bool)
func (MonitorHandle) DownscaleRequestAllowed ¶
func (h MonitorHandle) DownscaleRequestAllowed(now time.Time)
func (MonitorHandle) DownscaleRequestDenied ¶
func (h MonitorHandle) DownscaleRequestDenied(now time.Time)
Downscale request was successful but the monitor denied our request.
func (MonitorHandle) DownscaleRequestFailed ¶
func (h MonitorHandle) DownscaleRequestFailed(now time.Time)
func (MonitorHandle) Reset ¶
func (h MonitorHandle) Reset()
func (MonitorHandle) StartingDownscaleRequest ¶
func (h MonitorHandle) StartingDownscaleRequest(now time.Time, resources api.Resources)
func (MonitorHandle) StartingUpscaleRequest ¶
func (h MonitorHandle) StartingUpscaleRequest(now time.Time, resources api.Resources)
func (MonitorHandle) UpscaleRequestFailed ¶
func (h MonitorHandle) UpscaleRequestFailed(now time.Time)
func (MonitorHandle) UpscaleRequestSuccessful ¶
func (h MonitorHandle) UpscaleRequestSuccessful(now time.Time)
func (MonitorHandle) UpscaleRequested ¶
func (h MonitorHandle) UpscaleRequested(now time.Time, resources api.MoreResources)
type NeonVMHandle ¶
type NeonVMHandle struct {
// contains filtered or unexported fields
}
func (NeonVMHandle) RequestFailed ¶
func (h NeonVMHandle) RequestFailed(now time.Time)
func (NeonVMHandle) RequestSuccessful ¶
func (h NeonVMHandle) RequestSuccessful(now time.Time)
func (NeonVMHandle) StartingRequest ¶
func (h NeonVMHandle) StartingRequest(now time.Time, resources api.Resources)
type PluginHandle ¶
type PluginHandle struct {
// contains filtered or unexported fields
}
PluginHandle provides write access to the scheduler plugin pieces of an UpdateState
func (PluginHandle) RequestFailed ¶
func (h PluginHandle) RequestFailed(now time.Time)
func (PluginHandle) RequestSuccessful ¶
func (h PluginHandle) RequestSuccessful(now time.Time, resp api.PluginResponse) (_err error)
func (PluginHandle) StartingRequest ¶
func (h PluginHandle) StartingRequest(now time.Time, resources api.Resources)
type State ¶
type State struct {
// contains filtered or unexported fields
}
State holds all of the necessary internal state for a VM in order to make scaling decisions
func (*State) Debug ¶
Debug sets s.debug = enabled. This method is exclusively meant to be used in tests, to make it easier to enable print debugging only for a single call to NextActions, via s.warn() or otherwise.
func (*State) DesiredResourcesFromMetricsOrRequestedUpscaling ¶
func (s *State) DesiredResourcesFromMetricsOrRequestedUpscaling(now time.Time) (api.Resources, func(ActionSet) *time.Duration)
public version, for testing.
func (*State) Monitor ¶
func (s *State) Monitor() MonitorHandle
func (*State) NeonVM ¶
func (s *State) NeonVM() NeonVMHandle
func (*State) NextActions ¶
NextActions is used to implement the state machine. It's a pure function that *just* indicates what the executor should do.
func (*State) Plugin ¶
func (s *State) Plugin() PluginHandle