Documentation ¶
Index ¶
- Constants
- type Decider
- type DeciderSpec
- type DeciderStatus
- type MultiScaler
- func (m *MultiScaler) Create(ctx context.Context, decider *Decider) (*Decider, error)
- func (m *MultiScaler) Delete(_ context.Context, namespace, name string) error
- func (m *MultiScaler) Get(_ context.Context, namespace, name string) (*Decider, error)
- func (m *MultiScaler) Inform(event types.NamespacedName) bool
- func (m *MultiScaler) Poke(key types.NamespacedName, stat metrics.Stat)
- func (m *MultiScaler) Update(_ context.Context, decider *Decider) (*Decider, error)
- func (m *MultiScaler) Watch(fn func(types.NamespacedName))
- type ScaleResult
- type UniScaler
- type UniScalerFactory
Constants ¶
const MinActivators = 2
MinActivators is the minimum number of activators a revision will get.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Decider ¶
type Decider struct { metav1.ObjectMeta Spec DeciderSpec Status DeciderStatus }
Decider is a resource which observes the request load of a Revision and recommends a number of replicas to run. +k8s:deepcopy-gen=true
func (*Decider) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Decider.
func (*Decider) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type DeciderSpec ¶
type DeciderSpec struct { MaxScaleUpRate float64 MaxScaleDownRate float64 // The metric used for scaling, i.e. concurrency, rps. ScalingMetric string // The value of scaling metric per pod that we target to maintain. // TargetValue <= TotalValue. TargetValue float64 // The total value of scaling metric that a pod can maintain. TotalValue float64 // The burst capacity that user wants to maintain without queuing at the POD level. // Note, that queueing still might happen due to the non-ideal load balancing. TargetBurstCapacity float64 // ActivatorCapacity is the single activator capacity, for subsetting. ActivatorCapacity float64 // PanicThreshold is the threshold at which panic mode is entered. It represents // a factor of the currently observed load over the panic window over the ready // pods. I.e. if this is 2, panic mode will be entered if the observed metric // is twice as high as the current population can handle. PanicThreshold float64 // StableWindow is needed to determine when to exit panic mode. StableWindow time.Duration // InitialScale is the calculated initial scale of the revision, taking both // revision initial scale and cluster initial scale into account. Revision initial // scale overrides cluster initial scale. InitialScale int32 // Reachable describes whether the revision is referenced by any route. Reachable bool }
DeciderSpec is the parameters by which the Revision should be scaled.
type DeciderStatus ¶
type DeciderStatus struct { // DesiredScale is the target number of instances that autoscaler // this revision needs. DesiredScale int32 // ExcessBurstCapacity is the difference between spare capacity // (how much more load the pods in the revision deployment can take before being // overloaded) and the configured target burst capacity. // If this number is negative: Activator will be threaded in // the request path by the PodAutoscaler controller. ExcessBurstCapacity int32 // NumActivators is the computed number of activators // necessary to back the revision. NumActivators int32 }
DeciderStatus is the current scale recommendation.
type MultiScaler ¶
type MultiScaler struct {
// contains filtered or unexported fields
}
MultiScaler maintains a collection of UniScalers.
func NewMultiScaler ¶
func NewMultiScaler( stopCh <-chan struct{}, uniScalerFactory UniScalerFactory, logger *zap.SugaredLogger) *MultiScaler
NewMultiScaler constructs a MultiScaler.
func (*MultiScaler) Delete ¶
func (m *MultiScaler) Delete(_ context.Context, namespace, name string) error
Delete stops and removes a Decider.
func (*MultiScaler) Inform ¶
func (m *MultiScaler) Inform(event types.NamespacedName) bool
Inform sends an update to the registered watcher function, if it is set.
func (*MultiScaler) Poke ¶
func (m *MultiScaler) Poke(key types.NamespacedName, stat metrics.Stat)
Poke checks if the autoscaler needs to be run immediately.
func (*MultiScaler) Watch ¶
func (m *MultiScaler) Watch(fn func(types.NamespacedName))
Watch registers a singleton function to call when DeciderStatus is updated.
type ScaleResult ¶ added in v0.15.0
type ScaleResult struct { // DesiredPodCount is the number of pods Autoscaler suggests for the revision. DesiredPodCount int32 // ExcessBurstCapacity is computed headroom of the revision taking into // the account target burst capacity. ExcessBurstCapacity int32 // NumActivators is the number of activators required to back this revision. NumActivators int32 // ScaleValid specifies whether this scale result is valid, i.e. whether // Autoscaler had all the necessary information to compute a suggestion. ScaleValid bool }
ScaleResult holds the scale result of the UniScaler evaluation cycle.
type UniScaler ¶
type UniScaler interface { // Scale computes a scaling suggestion for a revision. Scale(context.Context, time.Time) ScaleResult // Update reconfigures the UniScaler according to the DeciderSpec. Update(*DeciderSpec) error }
UniScaler records statistics for a particular Decider and proposes the scale for the Decider's target based on those statistics.
func New ¶
func New( namespace string, revision string, metricClient metrics.MetricClient, podCounter resources.EndpointsCounter, deciderSpec *DeciderSpec, reporterCtx context.Context) (UniScaler, error)
New creates a new instance of default autoscaler implementation.
type UniScalerFactory ¶
UniScalerFactory creates a UniScaler for a given PA using the given dynamic configuration.