scalersconfig

package
v2.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CustomValidator added in v2.15.0

type CustomValidator interface {
	Validate() error
}

CustomValidator is an interface that can be implemented to validate the configuration of the typed config

type Params added in v2.15.0

type Params struct {
	// FieldName is the name of the field in the struct
	FieldName string

	// Names is the 'name' tag parameter defining the key in triggerMetadata, resolvedEnv or authParams
	Names []string

	// Optional is the 'optional' tag parameter defining if the parameter is optional
	Optional bool

	// Order is the 'order' tag parameter defining the parsing order in which the parameter is looked up
	// in the triggerMetadata, resolvedEnv or authParams maps
	Order []ParsingOrder

	// Default is the 'default' tag parameter defining the default value of the parameter if it's not found
	// in any of the maps from ParsingOrder
	Default string

	// Deprecated is the 'deprecated' tag parameter, if the map contain this parameter, it is considered
	// as an error and the DeprecatedMessage should be returned to the user
	Deprecated string

	// Enum is the 'enum' tag parameter defining the list of possible values for the parameter
	Enum []string

	// ExclusiveSet is the 'exclusiveSet' tag parameter defining the list of values that are mutually exclusive
	ExclusiveSet []string

	// RangeSeparator is the 'range' tag parameter defining the separator for range values
	RangeSeparator string

	// Separator is the tag parameter to define which separator will be used
	Separator string
}

Params is a struct that represents the parameter list that can be used in the keda tag

func (Params) DeprecatedMessage added in v2.15.0

func (p Params) DeprecatedMessage() string

DeprecatedMessage is a function that returns the optional deprecated message if the parameter is deprecated

func (Params) IsDeprecated added in v2.15.0

func (p Params) IsDeprecated() bool

IsDeprecated is a function that returns true if the parameter is deprecated

func (Params) IsNested added in v2.15.0

func (p Params) IsNested() bool

IsNested is a function that returns true if the parameter is nested

func (Params) Name added in v2.15.0

func (p Params) Name() string

Name returns the name of the parameter (or comma separated list of names if it has multiple)

type ParsingOrder added in v2.15.0

type ParsingOrder string

ParsingOrder is a type that represents the order in which the parameters are parsed

const (
	TriggerMetadata ParsingOrder = "triggerMetadata"
	ResolvedEnv     ParsingOrder = "resolvedEnv"
	AuthParams      ParsingOrder = "authParams"
)

Constants that represent the order in which the parameters are parsed

type ScalerConfig

type ScalerConfig struct {
	// ScalableObjectName specifies name of the ScaledObject/ScaledJob that owns this scaler
	ScalableObjectName string

	// ScalableObjectNamespace specifies name of the ScaledObject/ScaledJob that owns this scaler
	ScalableObjectNamespace string

	// ScalableObjectType specifies whether this Scaler is owned by ScaledObject or ScaledJob
	ScalableObjectType string

	// The timeout to be used on all HTTP requests from the controller
	GlobalHTTPTimeout time.Duration

	// Name of the trigger
	TriggerName string

	// Marks whether we should query metrics only during the polling interval
	// Any requests for metrics in between are read from the cache
	TriggerUseCachedMetrics bool

	// TriggerMetadata
	TriggerMetadata map[string]string

	// ResolvedEnv
	ResolvedEnv map[string]string

	// AuthParams
	AuthParams map[string]string

	// PodIdentity
	PodIdentity kedav1alpha1.AuthPodIdentity

	// TriggerIndex
	TriggerIndex int

	// TriggerUniqueKey for the scaler across KEDA. Useful to identify uniquely the scaler, eg: AWS credentials cache
	TriggerUniqueKey string

	// MetricType
	MetricType v2.MetricTargetType

	// When we use the scaler for composite scaler, we shouldn't require the value because it'll be ignored
	AsMetricSource bool
}

ScalerConfig contains config fields common for all scalers

func (*ScalerConfig) TypedConfig added in v2.15.0

func (sc *ScalerConfig) TypedConfig(typedConfig any) (err error)

TypedConfig is a function that is used to unmarshal the TriggerMetadata, ResolvedEnv and AuthParams populating the provided typedConfig where structure fields along with complementary field tags define declaratively the parsing rules

Jump to

Keyboard shortcuts

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