autoscaler

package
v0.38.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2021 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Autoscaler

type Autoscaler struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func New

func New(logger *zap.SugaredLogger) *Autoscaler

func (*Autoscaler) AddAPI

func (a *Autoscaler) AddAPI(api userconfig.Resource) error

func (*Autoscaler) AddScaler

func (a *Autoscaler) AddScaler(scaler Scaler, kind userconfig.Kind)

func (*Autoscaler) Awaken

func (a *Autoscaler) Awaken(api userconfig.Resource) error

func (*Autoscaler) RemoveAPI

func (a *Autoscaler) RemoveAPI(api userconfig.Resource)

func (*Autoscaler) Stop

func (a *Autoscaler) Stop()

type Client

type Client interface {
	Awaken(api userconfig.Resource) error
}

func NewClient

func NewClient(endpoint string) Client

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(autoscaler *Autoscaler) *Handler

func (*Handler) Awaken

func (h *Handler) Awaken(w http.ResponseWriter, r *http.Request)

type Scaler

type Scaler interface {
	Scale(apiName string, request int32) error
	GetInFlightRequests(apiName string, window time.Duration) (*float64, error)
	GetAutoscalingSpec(apiName string) (*userconfig.Autoscaling, error)
	CurrentReplicas(apiName string) (int32, error)
}

func NewAsyncScaler

func NewAsyncScaler(k8sClient *k8s.Client, promClient promv1.API) Scaler

func NewRealtimeScaler

func NewRealtimeScaler(k8sClient *k8s.Client, promClient promv1.API, logger *zap.SugaredLogger) Scaler

type ScalerFunc

type ScalerFunc struct {
	ScaleFunc               func(apiName string, request int32) error
	GetInFlightRequestsFunc func(apiName string, window time.Duration) (*float64, error)
	GetAutoscalingSpecFunc  func(apiName string) (*userconfig.Autoscaling, error)
	CurrentReplicasFunc     func(apiName string) (int32, error)
}

func (*ScalerFunc) CurrentReplicas

func (s *ScalerFunc) CurrentReplicas(apiName string) (int32, error)

func (*ScalerFunc) GetAutoscalingSpec

func (s *ScalerFunc) GetAutoscalingSpec(apiName string) (*userconfig.Autoscaling, error)

func (*ScalerFunc) GetInFlightRequests

func (s *ScalerFunc) GetInFlightRequests(apiName string, window time.Duration) (*float64, error)

func (*ScalerFunc) Scale

func (s *ScalerFunc) Scale(apiName string, request int32) error

Jump to

Keyboard shortcuts

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