scalertypes

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2025 License: Apache-2.0 Imports: 9 Imported by: 4 modules, 12 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DefaultResyncInterval = 30 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AutoScalerOptions

type AutoScalerOptions struct {
	Namespace     string
	ScaleInterval Duration
	GroupKind     schema.GroupKind
}

type DLXOptions

type DLXOptions struct {
	Namespace string

	// comma delimited
	TargetNameHeader                  string
	TargetPathHeader                  string
	TargetPort                        int
	ListenAddress                     string
	ResourceReadinessTimeout          Duration
	MultiTargetStrategy               MultiTargetStrategy
	LabelSelector                     string
	ResolveTargetsFromIngressCallback ResolveTargetsFromIngressCallback `json:"-"`
	ResyncInterval                    Duration
	KubeClientSet                     kubernetes.Interface `json:"-"`
}

type Duration

type Duration struct {
	time.Duration
}

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) error

type MultiTargetStrategy added in v0.5.1

type MultiTargetStrategy string
const (
	MultiTargetStrategyRandom  MultiTargetStrategy = "random"
	MultiTargetStrategyPrimary MultiTargetStrategy = "primary"
	MultiTargetStrategyCanary  MultiTargetStrategy = "canary"
)

type ResolveTargetsFromIngressCallback added in v0.10.0

type ResolveTargetsFromIngressCallback func(ingress *networkingv1.Ingress) ([]string, error)

ResolveTargetsFromIngressCallback defines a function that extracts a list of target identifiers (e.g., names of services the Ingress routes traffic to) from a Kubernetes Ingress resource.

This function is expected to be implemented externally and passed into the IngressWatcher, allowing for custom logic such as parsing annotations, labels, or other ingress metadata.

Parameters:

  • ingress: The Kubernetes Ingress resource to extract targets from

Returns:

  • []string: A slice of target identifiers (e.g., service names, endpoint addresses)
  • error: An error if target resolution fails

Implementation guidelines: - Return a non-nil slice when targets are successfully resolved - Return a non-nil error if resolution fails - Should handle nil or malformed Ingress objects gracefully and return an error in such cases

type Resource

type Resource struct {
	Name               string          `json:"name,omitempty"`
	Namespace          string          `json:"namespace,omitempty"`
	ScaleResources     []ScaleResource `json:"scale_resources,omitempty"`
	LastScaleEvent     *ScaleEvent     `json:"last_scale_event,omitempty"`
	LastScaleEventTime *time.Time      `json:"last_scale_event_time,omitempty"`
}

func (Resource) String

func (r Resource) String() string

type ResourceScaler

type ResourceScaler interface {
	SetScale([]Resource, int) error
	SetScaleCtx(context.Context, []Resource, int) error
	GetResources() ([]Resource, error)
	GetConfig() (*ResourceScalerConfig, error)
	ResolveServiceName(Resource) (string, error)
}

type ResourceScalerConfig

type ResourceScalerConfig struct {
	KubeconfigPath    string
	AutoScalerOptions AutoScalerOptions
	DLXOptions        DLXOptions
}

type ScaleEvent

type ScaleEvent string
const (
	ResourceUpdatedScaleEvent        ScaleEvent = "resourceUpdated"
	ScaleFromZeroStartedScaleEvent   ScaleEvent = "scaleFromZeroStarted"
	ScaleFromZeroCompletedScaleEvent ScaleEvent = "scaleFromZeroCompleted"
	ScaleToZeroStartedScaleEvent     ScaleEvent = "scaleToZeroStarted"
	ScaleToZeroCompletedScaleEvent   ScaleEvent = "scaleToZeroCompleted"
)

func ParseScaleEvent

func ParseScaleEvent(scaleEventStr string) (ScaleEvent, error)

type ScaleResource

type ScaleResource struct {
	MetricName string   `json:"metric_name,omitempty"`
	WindowSize Duration `json:"windows_size,omitempty"`
	Threshold  int      `json:"threshold,omitempty"`
}

func (ScaleResource) GetKubernetesMetricName

func (sr ScaleResource) GetKubernetesMetricName() string

func (ScaleResource) String

func (sr ScaleResource) String() string

Jump to

Keyboard shortcuts

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