scalers

package
v0.0.0-...-90dbcc8 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2019 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MSI_URL = "http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https%3A%2F%2Fstorage.azure.com%2F"
)

Variables

This section is empty.

Functions

func GetAzureQueueLength

func GetAzureQueueLength(ctx context.Context, usePodIdentity bool, connectionString, queueName string, accountName string) (int32, error)

GetAzureQueueLength returns the length of a queue in int

func GetEventHubClient

func GetEventHubClient(connectionString string) (*eventhub.Hub, error)

GetEventHubClient returns eventhub client

func GetQueueEntityFromNamespace

func GetQueueEntityFromNamespace(ctx context.Context, ns *servicebus.Namespace, queueName string) (int32, error)

func GetStorageCredentials

func GetStorageCredentials(storageConnection string) (azure.Environment, *azblob.SharedKeyCredential, error)

GetStorageCredentials returns azure env and storage credentials

func GetSubscriptionEntityFromNamespace

func GetSubscriptionEntityFromNamespace(ctx context.Context, ns *servicebus.Namespace, topicName, subscriptionName string) (int32, error)

func NewLiiklusScaler

func NewLiiklusScaler(resolvedEnv map[string]string, metadata map[string]string) (*liiklusScaler, error)

func ParseAzureEventHubConnectionString

func ParseAzureEventHubConnectionString(connectionString string) (string, string, error)

ParseAzureEventHubConnectionString parses Event Hub connection string into (namespace, name)

Connection string should be in following format:
Endpoint=sb://eventhub-namespace.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=secretKey123;EntityPath=eventhub-name

func ParseAzureStorageConnectionString

func ParseAzureStorageConnectionString(connectionString string) (string, string, string, string, error)

ParseAzureStorageConnectionString parses a storage account connection string into (endpointProtocol, accountName, key, endpointSuffix)

Connection string should be in following format:
DefaultEndpointsProtocol=https;AccountName=yourStorageAccountName;AccountKey=yourStorageAccountKey;EndpointSuffix=core.windows.net

Types

type AADToken

type AADToken struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	ExpiresIn    string `json:"expires_in"`
	ExpiresOn    string `json:"expires_on"`
	NotBefore    string `json:"not_before"`
	Resource     string `json:"resource"`
	TokenType    string `json:"token_type"`
}

AADToken is the token from Azure AD

type AzureEventHubScaler

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

func (*AzureEventHubScaler) Close

func (scaler *AzureEventHubScaler) Close() error

Close closes Azure Event Hub Scaler

func (*AzureEventHubScaler) GetMetricSpecForScaling

func (scaler *AzureEventHubScaler) GetMetricSpecForScaling() []v2beta1.MetricSpec

GetMetricSpecForScaling returns metric spec

func (*AzureEventHubScaler) GetMetrics

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

GetMetrics returns metric using total number of unprocessed events in event hub

func (*AzureEventHubScaler) GetUnprocessedEventCountInPartition

func (scaler *AzureEventHubScaler) GetUnprocessedEventCountInPartition(ctx context.Context, partitionID string) (newEventCount int64, err error)

GetUnprocessedEventCountInPartition gets number of unprocessed events in a given partition

func (*AzureEventHubScaler) IsActive

func (scaler *AzureEventHubScaler) IsActive(ctx context.Context) (bool, error)

IsActive determines if eventhub is active based on number of unprocessed events

type Checkpoint

type Checkpoint struct {
	Epoch          int64  `json:"Epoch"`
	Offset         string `json:"Offset"`
	Owner          string `json:"Owner"`
	PartitionID    string `json:"PartitionId"`
	SequenceNumber int64  `json:"SequenceNumber"`
	Token          string `json:"Token"`
}

func GetCheckpointFromBlobStorage

func GetCheckpointFromBlobStorage(ctx context.Context, partitionID string, eventHubMetadata EventHubMetadata) (Checkpoint, error)

GetCheckpointFromBlobStorage accesses Blob storage and gets checkpoint information of a partition

type EntityType

type EntityType int
const (
	None         EntityType = 0
	Queue        EntityType = 1
	Subscription EntityType = 2
)

type EventHubMetadata

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

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 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 deployment scales. This is used to contruct the HPA spec that is created for
	// this scaled object. The labels used should match the selectors used in GetMetrics
	GetMetricSpecForScaling() []v2beta1.MetricSpec

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

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

func NewAwsCloudwatchScaler

func NewAwsCloudwatchScaler(resolvedEnv, metadata map[string]string) (Scaler, error)

NewAwsCloudwatchScaler creates a new awsCloudwatchScaler

func NewAwsSqsQueueScaler

func NewAwsSqsQueueScaler(resolvedEnv, metadata map[string]string) (Scaler, error)

NewAwsSqsQueueScaler creates a new awsSqsQueueScaler

func NewAzureEventHubScaler

func NewAzureEventHubScaler(resolvedEnv, metadata map[string]string) (Scaler, error)

NewAzureEventHubScaler creates a new scaler for eventHub

func NewAzureQueueScaler

func NewAzureQueueScaler(resolvedEnv, metadata map[string]string) (Scaler, error)

NewAzureQueueScaler creates a new azureQueueScaler

func NewAzureServiceBusScaler

func NewAzureServiceBusScaler(resolvedEnv, metadata map[string]string) (Scaler, error)

NewAzureServiceBusScaler creates a new AzureServiceBusScaler

func NewKafkaScaler

func NewKafkaScaler(resolvedSecrets, metadata map[string]string) (Scaler, error)

NewKafkaScaler creates a new kafkaScaler

func NewPrometheusScaler

func NewPrometheusScaler(resolvedEnv, metadata map[string]string) (Scaler, error)

NewPrometheusScaler creates a new prometheusScaler

func NewPubSubScaler

func NewPubSubScaler(resolvedEnv, metadata map[string]string) (Scaler, error)

NewPubSubScaler creates a new pubsubScaler

func NewRabbitMQScaler

func NewRabbitMQScaler(resolvedEnv, metadata map[string]string) (Scaler, error)

NewRabbitMQScaler creates a new rabbitMQ scaler

func NewRedisScaler

func NewRedisScaler(resolvedEnv, metadata map[string]string) (Scaler, error)

NewRedisScaler creates a new redisScaler

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 (StackDriverClient) GetMetrics

func (s StackDriverClient) GetMetrics(ctx context.Context, filter string) (int64, error)

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

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