core

package
v0.20.0-patch1 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

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

type ActionWait struct {
	Duration time.Duration `json:"duration"`
}

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 {
	// 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

	// MonitorDownscaleFollowUpWait gives the minimum time we must wait between subsequent downscale
	// requests, *whether or not they are a duplicate*.
	MonitorDownscaleFollowUpWait 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 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 OngoingMonitorRequestDump

type OngoingMonitorRequestDump struct {
	Kind      monitorRequestKind `json:"kind"`
	Requested api.Resources      `json:"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 NewState

func NewState(vm api.VmInfo, config Config) *State

func (*State) Debug

func (s *State) Debug(enabled bool)

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)

func (*State) Dump

func (s *State) Dump() StateDump

Dump produces a JSON-serializable copy of the State

func (*State) Monitor

func (s *State) Monitor() MonitorHandle

func (*State) NeonVM

func (s *State) NeonVM() NeonVMHandle

func (*State) NextActions

func (s *State) NextActions(now time.Time) ActionSet

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

func (*State) UpdateMetrics

func (s *State) UpdateMetrics(metrics api.Metrics)

func (*State) UpdatedVM

func (s *State) UpdatedVM(vm api.VmInfo)

type StateDump

type StateDump struct {
	Config  Config           `json:"config"`
	VM      api.VmInfo       `json:"vm"`
	Plugin  pluginStateDump  `json:"plugin"`
	Monitor monitorStateDump `json:"monitor"`
	NeonVM  neonvmStateDump  `json:"neonvm"`
	Metrics *api.Metrics     `json:"metrics"`
}

StateDump provides introspection into the current values of the fields of State

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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