controllers

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 50 Imported by: 0

Documentation

Overview

Package controllers containers all the WatermarkPodAutoscaler controller logic.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLogAttrsFromWpa added in v0.4.0

func GetLogAttrsFromWpa(wpa *datadoghqv1alpha1.WatermarkPodAutoscaler) ([]interface{}, error)

GetLogAttrsFromWpa returns a slice of all key/value pairs specified in the WPA log attributes annotation json.

Types

type ReplicaCalculation

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

ReplicaCalculation is used to compute the scaling recommendation.

type ReplicaCalculator

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

ReplicaCalculator is responsible for calculation of the number of replicas It contains all the needed information

func NewReplicaCalculator

func NewReplicaCalculator(metricsClient metricsclient.MetricsClient, podLister corelisters.PodLister) *ReplicaCalculator

NewReplicaCalculator returns a ReplicaCalculator object reference

func (*ReplicaCalculator) GetExternalMetricReplicas

func (c *ReplicaCalculator) GetExternalMetricReplicas(logger logr.Logger, target *autoscalingv1.Scale, metric v1alpha1.MetricSpec, wpa *v1alpha1.WatermarkPodAutoscaler) (ReplicaCalculation, error)

GetExternalMetricReplicas calculates the desired replica count based on a target metric value (as a milli-value) for the external metric in the given namespace, and the current replica count.

func (*ReplicaCalculator) GetResourceReplicas

GetResourceReplicas calculates the desired replica count based on a target resource utilization percentage of the given resource for pods matching the given selector in the given namespace, and the current replica count

type ReplicaCalculatorItf

type ReplicaCalculatorItf interface {
	GetExternalMetricReplicas(logger logr.Logger, target *autoscalingv1.Scale, metric v1alpha1.MetricSpec, wpa *v1alpha1.WatermarkPodAutoscaler) (replicaCalculation ReplicaCalculation, err error)
	GetResourceReplicas(logger logr.Logger, target *autoscalingv1.Scale, metric v1alpha1.MetricSpec, wpa *v1alpha1.WatermarkPodAutoscaler) (replicaCalculation ReplicaCalculation, err error)
}

ReplicaCalculatorItf interface for ReplicaCalculator

type WatermarkPodAutoscalerReconciler

type WatermarkPodAutoscalerReconciler struct {
	// This client, initialized using mgr.Client() above, is a split client
	// that reads objects from the cache and writes to the apiserver
	Client client.Client
	Log    logr.Logger
	Scheme *runtime.Scheme
	// contains filtered or unexported fields
}

WatermarkPodAutoscalerReconciler reconciles a WatermarkPodAutoscaler object

func (*WatermarkPodAutoscalerReconciler) Reconcile

Reconcile reads that state of the cluster for a WatermarkPodAutoscaler object and makes changes based on the state read and what is in the WatermarkPodAutoscaler.Spec The Controller will requeue the Request to be processed again if the returned error is non-nil or Result.Requeue is true, otherwise upon completion it will remove the work from the queue.

func (*WatermarkPodAutoscalerReconciler) SetupWithManager

func (r *WatermarkPodAutoscalerReconciler) SetupWithManager(mgr ctrl.Manager, workers int) error

SetupWithManager creates a new Watermarkpodautoscaler controller

Directories

Path Synopsis
test
utils
Package utils provides a set of test utils functions.
Package utils provides a set of test utils functions.

Jump to

Keyboard shortcuts

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