scalers

package
v2.8.2 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: Apache-2.0 Imports: 115 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MockExternalServerStatusOffline int32 = 0
	MockExternalServerStatusOnline  int32 = 1
)
View Source
const (
	KafkaSASLTypeNone        kafkaSaslType = "none"
	KafkaSASLTypePlaintext   kafkaSaslType = "plaintext"
	KafkaSASLTypeSCRAMSHA256 kafkaSaslType = "scram_sha256"
	KafkaSASLTypeSCRAMSHA512 kafkaSaslType = "scram_sha512"
)

supported SASL types

View Source
const (
	DefaultBrowserVersion string = "latest"
)

Variables

View Source
var (
	MockExternalServerStatus       = MockExternalServerStatusOnline
	ErrMock                        = errors.New("mock error")
	MockMetricName                 = "mockMetricName"
	MockMetricTarget         int64 = 50
	MockMetricValue          int64 = 100
)

SHA256 hash generator function for SCRAM conversation

SHA512 hash generator function for SCRAM conversation

Functions

func AvgFloatFromSlice added in v2.8.2

func AvgFloatFromSlice(results []float64) float64

Find the average value in a slice of floats

func GenerateMetricInMili added in v2.8.0

func GenerateMetricInMili(metricName string, value float64) external_metrics.ExternalMetricValue

GenerateMetricInMili returns a externalMetricValue with mili as metric scale

func GenerateMetricNameWithIndex added in v2.5.0

func GenerateMetricNameWithIndex(scalerIndex int, metricName string) string

GenerateMetricNameWithIndex helps adding the index prefix to the metric name

func GetFromAuthOrMeta added in v2.5.0

func GetFromAuthOrMeta(config *ScalerConfig, field string) (string, error)

GetFromAuthOrMeta helps getting a field from Auth or Meta sections

func GetMetricTarget added in v2.7.0

func GetMetricTarget(metricType v2beta2.MetricTargetType, metricValue int64) v2beta2.MetricTarget

GetMetricTarget returns a metric target for a valid given metric target type (Value or AverageValue) and value

func GetMetricTargetMili added in v2.8.0

func GetMetricTargetMili(metricType v2beta2.MetricTargetType, metricValue float64) v2beta2.MetricTarget

GetMetricTargetMili returns a metric target for a valid given metric target type (Value or AverageValue) and value in mili scale

func GetMetricTargetType added in v2.7.0

func GetMetricTargetType(config *ScalerConfig) (v2beta2.MetricTargetType, error)

GetMetricTargetType helps getting the metric target type of the scaler

func GetUnprocessedEventCountWithoutCheckpoint

func GetUnprocessedEventCountWithoutCheckpoint(partitionInfo *eventhub.HubPartitionRuntimeInformation) int64

GetUnprocessedEventCountWithoutCheckpoint returns the number of messages on the without a checkoutpoint info

func GetValueFromResponse

func GetValueFromResponse(body []byte, valueLocation string) (float64, error)

GetValueFromResponse uses provided valueLocation to access the numeric value in provided body

func InitializeLogger added in v2.8.0

func InitializeLogger(config *ScalerConfig, scalerName string) logr.Logger

func MaxFloatFromSlice added in v2.8.2

func MaxFloatFromSlice(results []float64) float64

Find the largest value in a slice of floats

func NewStackdriverAggregator added in v2.8.0

func NewStackdriverAggregator(period int64, aligner string, reducer string) (*monitoringpb.Aggregation, error)

func RemoveIndexFromMetricName added in v2.7.0

func RemoveIndexFromMetricName(scalerIndex int, metricName string) (string, error)

RemoveIndexFromMetricName removes the index prefix from the metric name

Types

type CassandraMetadata added in v2.5.0

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

CassandraMetadata defines metadata used by KEDA to query a Cassandra table.

type CommandResponse

type CommandResponse struct {
	CommandResponse []Response `json:"commandResponse"`
}

CommandResponse Full structured response from MQ admin REST query

type GoogleApplicationCredentials

type GoogleApplicationCredentials struct {
	Type                string `json:"type"`
	ProjectID           string `json:"project_id"`
	PrivateKeyID        string `json:"private_key_id"`
	PrivateKey          string `json:"private_key"`
	ClientEmail         string `json:"client_email"`
	ClientID            string `json:"client_id"`
	AuthURI             string `json:"auth_uri"`
	TokenURI            string `json:"token_uri"`
	AuthProviderCertURL string `json:"auth_provider_x509_cert_url"`
	ClientX509CertURL   string `json:"client_x509_cert_url"`
}

GoogleApplicationCredentials is a struct representing the format of a service account credentials file

type IBMMQMetadata

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

IBMMQMetadata Metadata used by KEDA to query IBM MQ queue depth and scale

type IBMMQScaler

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

IBMMQScaler assigns struct data pointer to metadata variable

func (*IBMMQScaler) Close

func (s *IBMMQScaler) Close(context.Context) error

Close closes and returns nil

func (*IBMMQScaler) GetMetricSpecForScaling

func (s *IBMMQScaler) GetMetricSpecForScaling(context.Context) []v2beta2.MetricSpec

GetMetricSpecForScaling returns the MetricSpec for the Horizontal Pod Autoscaler

func (*IBMMQScaler) GetMetrics

func (s *IBMMQScaler) GetMetrics(ctx context.Context, metricName string, metricSelector labels.Selector) ([]external_metrics.ExternalMetricValue, error)

GetMetrics returns value for a supported metric and an error if there is a problem getting the metric

func (*IBMMQScaler) IsActive

func (s *IBMMQScaler) IsActive(ctx context.Context) (bool, error)

IsActive returns true if there are messages to be processed/if we need to scale from zero

type Parameters

type Parameters struct {
	Curdepth int `json:"curdepth"`
}

Parameters Contains the current depth of the IBM MQ Queue

type PredictKubeScaler added in v2.6.0

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

func NewPredictKubeScaler added in v2.6.0

func NewPredictKubeScaler(ctx context.Context, config *ScalerConfig) (*PredictKubeScaler, error)

NewPredictKubeScaler creates a new PredictKube scaler

func (*PredictKubeScaler) Close added in v2.6.0

func (s *PredictKubeScaler) Close(_ context.Context) error

func (*PredictKubeScaler) GetMetricSpecForScaling added in v2.6.0

func (s *PredictKubeScaler) GetMetricSpecForScaling(context.Context) []v2beta2.MetricSpec

func (*PredictKubeScaler) GetMetrics added in v2.6.0

func (*PredictKubeScaler) IsActive added in v2.6.0

func (s *PredictKubeScaler) IsActive(ctx context.Context) (bool, error)

IsActive returns true if we are able to get metrics from PredictKube

type PushScaler

type PushScaler interface {
	Scaler

	// Run is the only writer to the active channel and must close it once done.
	Run(ctx context.Context, active chan<- bool)
}

PushScaler interface

func NewExternalPushScaler

func NewExternalPushScaler(config *ScalerConfig) (PushScaler, error)

NewExternalPushScaler creates a new externalPushScaler push scaler

type Response

type Response struct {
	Parameters Parameters `json:"parameters"`
}

Response The body of the response returned from the MQ admin query

type Scaler

type Scaler interface {

	// The scaler returns the metric values for a metric Name and criteria matching the selector
	GetMetrics(ctx context.Context, metricName string, metricSelector labels.Selector) ([]external_metrics.ExternalMetricValue, error)

	// Returns the metrics based on which this scaler determines that the ScaleTarget scales. This is used to construct the HPA spec that is created for
	// this scaled object. The labels used should match the selectors used in GetMetrics
	GetMetricSpecForScaling(ctx context.Context) []v2beta2.MetricSpec

	IsActive(ctx context.Context) (bool, error)

	// Close any resources that need disposing when scaler is no longer used or destroyed
	Close(ctx context.Context) error
}

Scaler interface

func NewActiveMQScaler added in v2.6.0

func NewActiveMQScaler(config *ScalerConfig) (Scaler, error)

NewActiveMQScaler creates a new activeMQ Scaler

func NewArtemisQueueScaler

func NewArtemisQueueScaler(config *ScalerConfig) (Scaler, error)

NewArtemisQueueScaler creates a new artemis queue Scaler

func NewAwsCloudwatchScaler

func NewAwsCloudwatchScaler(config *ScalerConfig) (Scaler, error)

NewAwsCloudwatchScaler creates a new awsCloudwatchScaler

func NewAwsDynamoDBScaler added in v2.7.0

func NewAwsDynamoDBScaler(config *ScalerConfig) (Scaler, error)

func NewAwsDynamoDBStreamsScaler added in v2.8.0

func NewAwsDynamoDBStreamsScaler(ctx context.Context, config *ScalerConfig) (Scaler, error)

NewAwsDynamoDBStreamsScaler creates a new awsDynamoDBStreamsScaler

func NewAwsKinesisStreamScaler

func NewAwsKinesisStreamScaler(config *ScalerConfig) (Scaler, error)

NewAwsKinesisStreamScaler creates a new awsKinesisStreamScaler

func NewAwsSqsQueueScaler

func NewAwsSqsQueueScaler(config *ScalerConfig) (Scaler, error)

NewAwsSqsQueueScaler creates a new awsSqsQueueScaler

func NewAzureAppInsightsScaler added in v2.6.0

func NewAzureAppInsightsScaler(config *ScalerConfig) (Scaler, error)

NewAzureAppInsightsScaler creates a new AzureAppInsightsScaler

func NewAzureBlobScaler

func NewAzureBlobScaler(config *ScalerConfig) (Scaler, error)

NewAzureBlobScaler creates a new azureBlobScaler

func NewAzureDataExplorerScaler added in v2.7.0

func NewAzureDataExplorerScaler(ctx context.Context, config *ScalerConfig) (Scaler, error)

func NewAzureEventHubScaler

func NewAzureEventHubScaler(ctx context.Context, config *ScalerConfig) (Scaler, error)

NewAzureEventHubScaler creates a new scaler for eventHub

func NewAzureLogAnalyticsScaler

func NewAzureLogAnalyticsScaler(config *ScalerConfig) (Scaler, error)

NewAzureLogAnalyticsScaler creates a new Azure Log Analytics Scaler

func NewAzureMonitorScaler

func NewAzureMonitorScaler(config *ScalerConfig) (Scaler, error)

NewAzureMonitorScaler creates a new AzureMonitorScaler

func NewAzurePipelinesScaler added in v2.3.0

func NewAzurePipelinesScaler(ctx context.Context, config *ScalerConfig) (Scaler, error)

NewAzurePipelinesScaler creates a new AzurePipelinesScaler

func NewAzureQueueScaler

func NewAzureQueueScaler(config *ScalerConfig) (Scaler, error)

NewAzureQueueScaler creates a new scaler for queue

func NewAzureServiceBusScaler

func NewAzureServiceBusScaler(ctx context.Context, config *ScalerConfig) (Scaler, error)

NewAzureServiceBusScaler creates a new AzureServiceBusScaler

func NewCPUMemoryScaler

func NewCPUMemoryScaler(resourceName v1.ResourceName, config *ScalerConfig) (Scaler, error)

NewCPUMemoryScaler creates a new cpuMemoryScaler

func NewCassandraScaler added in v2.5.0

func NewCassandraScaler(config *ScalerConfig) (Scaler, error)

NewCassandraScaler creates a new Cassandra scaler.

func NewCronScaler

func NewCronScaler(config *ScalerConfig) (Scaler, error)

NewCronScaler creates a new cronScaler

func NewDatadogScaler added in v2.6.0

func NewDatadogScaler(ctx context.Context, config *ScalerConfig) (Scaler, error)

NewDatadogScaler creates a new Datadog scaler

func NewElasticsearchScaler added in v2.5.0

func NewElasticsearchScaler(config *ScalerConfig) (Scaler, error)

NewElasticsearchScaler creates a new elasticsearch scaler

func NewExternalMockScaler added in v2.8.0

func NewExternalMockScaler(config *ScalerConfig) (Scaler, error)

func NewExternalScaler

func NewExternalScaler(config *ScalerConfig) (Scaler, error)

NewExternalScaler creates a new external scaler - calls the GRPC interface to create a new scaler

func NewGcsScaler added in v2.7.0

func NewGcsScaler(config *ScalerConfig) (Scaler, error)

NewGcsScaler creates a new gcsScaler

func NewGraphiteScaler added in v2.5.0

func NewGraphiteScaler(config *ScalerConfig) (Scaler, error)

NewGraphiteScaler creates a new graphiteScaler

func NewHuaweiCloudeyeScaler

func NewHuaweiCloudeyeScaler(config *ScalerConfig) (Scaler, error)

NewHuaweiCloudeyeScaler creates a new huaweiCloudeyeScaler

func NewIBMMQScaler

func NewIBMMQScaler(config *ScalerConfig) (Scaler, error)

NewIBMMQScaler creates a new IBM MQ scaler

func NewInfluxDBScaler

func NewInfluxDBScaler(config *ScalerConfig) (Scaler, error)

NewInfluxDBScaler creates a new influx db scaler

func NewKafkaScaler

func NewKafkaScaler(config *ScalerConfig) (Scaler, error)

NewKafkaScaler creates a new kafkaScaler

func NewKubernetesWorkloadScaler added in v2.4.0

func NewKubernetesWorkloadScaler(kubeClient client.Client, config *ScalerConfig) (Scaler, error)

NewKubernetesWorkloadScaler creates a new kubernetesWorkloadScaler

func NewLiiklusScaler

func NewLiiklusScaler(config *ScalerConfig) (Scaler, error)

NewLiiklusScaler creates a new liiklusScaler scaler

func NewMSSQLScaler added in v2.2.0

func NewMSSQLScaler(config *ScalerConfig) (Scaler, error)

NewMSSQLScaler creates a new mssql scaler

func NewMetricsAPIScaler

func NewMetricsAPIScaler(config *ScalerConfig) (Scaler, error)

NewMetricsAPIScaler creates a new HTTP scaler

func NewMongoDBScaler

func NewMongoDBScaler(ctx context.Context, config *ScalerConfig) (Scaler, error)

NewMongoDBScaler creates a new mongoDB scaler

func NewMySQLScaler

func NewMySQLScaler(config *ScalerConfig) (Scaler, error)

NewMySQLScaler creates a new MySQL scaler

func NewNATSJetStreamScaler added in v2.8.0

func NewNATSJetStreamScaler(config *ScalerConfig) (Scaler, error)

func NewNewRelicScaler added in v2.6.0

func NewNewRelicScaler(config *ScalerConfig) (Scaler, error)

func NewOpenstackMetricScaler added in v2.3.0

func NewOpenstackMetricScaler(ctx context.Context, config *ScalerConfig) (Scaler, error)

NewOpenstackMetricScaler creates new openstack metrics scaler instance

func NewOpenstackSwiftScaler

func NewOpenstackSwiftScaler(ctx context.Context, config *ScalerConfig) (Scaler, error)

NewOpenstackSwiftScaler creates a new OpenStack Swift scaler

func NewPostgreSQLScaler

func NewPostgreSQLScaler(config *ScalerConfig) (Scaler, error)

NewPostgreSQLScaler creates a new postgreSQL scaler

func NewPrometheusScaler

func NewPrometheusScaler(config *ScalerConfig) (Scaler, error)

NewPrometheusScaler creates a new prometheusScaler

func NewPubSubScaler

func NewPubSubScaler(config *ScalerConfig) (Scaler, error)

NewPubSubScaler creates a new pubsubScaler

func NewPulsarScaler added in v2.8.0

func NewPulsarScaler(config *ScalerConfig) (Scaler, error)

NewPulsarScaler creates a new PulsarScaler

func NewRabbitMQScaler

func NewRabbitMQScaler(config *ScalerConfig) (Scaler, error)

NewRabbitMQScaler creates a new rabbitMQ scaler

func NewRedisScaler

func NewRedisScaler(ctx context.Context, isClustered, isSentinel bool, config *ScalerConfig) (Scaler, error)

NewRedisScaler creates a new redisScaler

func NewRedisStreamsScaler

func NewRedisStreamsScaler(ctx context.Context, isClustered, isSentinel bool, config *ScalerConfig) (Scaler, error)

NewRedisStreamsScaler creates a new redisStreamsScaler

func NewSeleniumGridScaler added in v2.4.0

func NewSeleniumGridScaler(config *ScalerConfig) (Scaler, error)

func NewSolaceScaler added in v2.4.0

func NewSolaceScaler(config *ScalerConfig) (Scaler, error)

Constructor for SolaceScaler

func NewStackdriverScaler added in v2.7.0

func NewStackdriverScaler(ctx context.Context, config *ScalerConfig) (Scaler, error)

NewStackdriverScaler creates a new stackdriverScaler

func NewStanScaler

func NewStanScaler(config *ScalerConfig) (Scaler, error)

NewStanScaler creates a new stanScaler

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

	// TriggerMetadata
	TriggerMetadata map[string]string

	// ResolvedEnv
	ResolvedEnv map[string]string

	// AuthParams
	AuthParams map[string]string

	// PodIdentity
	PodIdentity kedav1alpha1.AuthPodIdentity

	// ScalerIndex
	ScalerIndex int

	// MetricType
	MetricType v2beta2.MetricTargetType
}

ScalerConfig contains config fields common for all scalers

type SolaceMetadata added in v2.4.0

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

type SolaceMetricValues added in v2.4.0

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

Struct for Observed Metric Values

type SolaceScaler added in v2.4.0

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

func (*SolaceScaler) Close added in v2.4.0

func (s *SolaceScaler) Close(context.Context) error

Do Nothing - Satisfies Interface

func (*SolaceScaler) GetMetricSpecForScaling added in v2.4.0

func (s *SolaceScaler) GetMetricSpecForScaling(context.Context) []v2beta2.MetricSpec

INTERFACE METHOD DEFINE METRIC FOR SCALING CURRENT SUPPORTED METRICS ARE: - QUEUE MESSAGE COUNT (msgCount) - QUEUE SPOOL USAGE (msgSpoolUsage in MBytes) METRIC IDENTIFIER HAS THE SIGNATURE: - solace-[Queue_Name]-[metric_type] e.g. solace-QUEUE1-msgCount

func (*SolaceScaler) GetMetrics added in v2.4.0

func (s *SolaceScaler) GetMetrics(ctx context.Context, metricName string, metricSelector labels.Selector) ([]external_metrics.ExternalMetricValue, error)

INTERFACE METHOD Call SEMP API to retrieve metrics returns value for named metric

func (*SolaceScaler) IsActive added in v2.4.0

func (s *SolaceScaler) IsActive(ctx context.Context) (bool, error)

INTERFACE METHOD Call SEMP API to retrieve metrics IsActive returns true if queue messageCount > 0 || msgSpoolUsage > 0

type StackDriverClient

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

StackDriverClient is a generic client to fetch metrics from Stackdriver. Can be used for a stackdriver scaler in the future

func NewStackDriverClient

func NewStackDriverClient(ctx context.Context, credentials string) (*StackDriverClient, error)

NewStackDriverClient creates a new stackdriver client with the credentials that are passed

func NewStackDriverClientPodIdentity added in v2.5.0

func NewStackDriverClientPodIdentity(ctx context.Context) (*StackDriverClient, error)

NewStackDriverClient creates a new stackdriver client with the credentials underlying

func (StackDriverClient) GetMetrics

func (s StackDriverClient) GetMetrics(
	ctx context.Context,
	filter string,
	projectID string,
	aggregation *monitoringpb.Aggregation) (float64, error)

GetMetrics fetches metrics from stackdriver for a specific filter for the last minute

type XDGSCRAMClient

type XDGSCRAMClient struct {
	*scram.Client
	*scram.ClientConversation
	scram.HashGeneratorFcn
}

XDGSCRAMClient struct to perform SCRAM conversation

func (*XDGSCRAMClient) Begin

func (x *XDGSCRAMClient) Begin(userName, password, authzID string) (err error)

Begin starts SCRAM conversation

func (*XDGSCRAMClient) Done

func (x *XDGSCRAMClient) Done() bool

Done completes SCRAM conversation

func (*XDGSCRAMClient) Step

func (x *XDGSCRAMClient) Step(challenge string) (response string, err error)

Step performs step in SCRAM conversation

Directories

Path Synopsis
mocks
Package mock_liiklus is a generated GoMock package.
Package mock_liiklus is a generated GoMock package.

Jump to

Keyboard shortcuts

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