k8sautoscale

package module
v0.2.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

package k8sautoscale implements Deployments and Deployment interface for a Kubernetes cluster.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InClusterAutoscaler

func InClusterAutoscaler(
	ctx context.Context,
	configPath string,
	time int64,
	scaleReporter interfaces.ScaleReporter,
) (*wqautoscale.AutoScale, error)

InClusterAutoscaler creates an autoscaler for scaling deployments within the cluster the process is running within.

Types

type Config

type Config struct {
	// Namespace of the k8s deployments.
	Namespace string
	// Redis options for accessing work queues.
	Redis redis.Options
	// QueueNamePrefix is the prefix used for generating queue names.
	QueueNamePrefix string `yaml:"queueNamePrefix"`
	// SegmentedDeployments determines if the k8s deployments interface should be wrapped in `SegmentedDeployments`.
	//
	// This allows deployment counts to be segmented.
	SegmentedDeployments bool `yaml:"segmentedDeployments"`
	// Autoscale config.
	Autoscale wqautoscale.Config
}

func LoadConfig

func LoadConfig(configPath string) (Config, error)

type WorkQueues

type WorkQueues struct {
	NamePrefix workqueue.KeyPrefix
	DB         *redis.Client
}

WorkQueues provides an interface allowing work queues to be generated by name.

func NewWorkQueues

func NewWorkQueues(namePrefix string, db *redis.Client) *WorkQueues

func (*WorkQueues) GetWorkQueue

func (queues *WorkQueues) GetWorkQueue(name string) wqautoscale.WorkQueue

type WrappedWorkQueue

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

WrappedWorkQueue is a WorkQueue, wrapped with a redis database, providing the TotalItems method.

func (*WrappedWorkQueue) Counts

func (wrapped *WrappedWorkQueue) Counts(ctx context.Context) (queueLen, processing int32, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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