federatedhpa

package
v1.11.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const ControllerName = "federatedHPA-controller"

ControllerName is the controller name that will be used when reporting events.

Variables

This section is empty.

Functions

This section is empty.

Types

type FHPAController added in v1.9.0

type FHPAController struct {
	client.Client
	ReplicaCalc               *ReplicaCalculator
	ClusterScaleClientSetFunc func(string, client.Client) (*util.ClusterScaleClient, error)
	RESTMapper                meta.RESTMapper
	EventRecorder             record.EventRecorder
	TypedInformerManager      typedmanager.MultiClusterInformerManager
	ClusterCacheSyncTimeout   metav1.Duration

	HorizontalPodAutoscalerSyncPeriod time.Duration
	DownscaleStabilisationWindow      time.Duration

	RateLimiterOptions ratelimiterflag.Options
	// contains filtered or unexported fields
}

FHPAController is to sync FederatedHPA.

func (*FHPAController) Reconcile added in v1.9.0

Reconcile performs a full reconciliation for the object referred to by the Request. The Controller will requeue the Request to be processed again if an error is non-nil or Result.Requeue is true, otherwise upon completion it will remove the work from the queue.

func (*FHPAController) SetupWithManager added in v1.9.0

func (c *FHPAController) SetupWithManager(mgr controllerruntime.Manager) error

SetupWithManager creates a controller and register to controller manager.

type NormalizationArg

type NormalizationArg struct {
	Key               string
	ScaleUpBehavior   *autoscalingv2.HPAScalingRules
	ScaleDownBehavior *autoscalingv2.HPAScalingRules
	MinReplicas       int32
	MaxReplicas       int32
	CurrentReplicas   int32
	DesiredReplicas   int32
}

NormalizationArg is used to pass all needed information between functions as one structure

type ReplicaCalculator

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

ReplicaCalculator bundles all needed information to calculate the target amount of replicas

func NewReplicaCalculator

func NewReplicaCalculator(metricsClient metricsclient.QueryClient, tolerance float64, cpuInitializationPeriod, delayOfInitialReadinessStatus time.Duration) *ReplicaCalculator

NewReplicaCalculator creates a new ReplicaCalculator and passes all necessary information to the new instance

func (*ReplicaCalculator) GetMetricReplicas added in v1.7.0

func (c *ReplicaCalculator) GetMetricReplicas(currentReplicas int32, targetUsage int64, metricName string, namespace string, selector labels.Selector, metricSelector labels.Selector, podList []*corev1.Pod, calibration float64) (replicaCount int32, usage int64, timestamp time.Time, err error)

GetMetricReplicas calculates the desired replica count based on a target metric usage (as a milli-value) for pods matching the given selector in the given namespace, and the current replica count

func (*ReplicaCalculator) GetObjectMetricReplicas added in v1.7.0

func (c *ReplicaCalculator) GetObjectMetricReplicas(currentReplicas int32, targetUsage int64, metricName string, namespace string, objectRef *autoscalingv2.CrossVersionObjectReference, metricSelector labels.Selector, podList []*corev1.Pod, calibration float64) (replicaCount int32, usage int64, timestamp time.Time, err error)

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

func (*ReplicaCalculator) GetObjectPerPodMetricReplicas added in v1.7.0

func (c *ReplicaCalculator) GetObjectPerPodMetricReplicas(statusReplicas int32, targetAverageUsage int64, metricName string, namespace string, objectRef *autoscalingv2.CrossVersionObjectReference, metricSelector labels.Selector, calibration float64) (replicaCount int32, usage int64, timestamp time.Time, err error)

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

func (*ReplicaCalculator) GetRawResourceReplicas

func (c *ReplicaCalculator) GetRawResourceReplicas(ctx context.Context, currentReplicas int32, targetUsage int64, resource corev1.ResourceName, namespace string, selector labels.Selector, container string, podList []*corev1.Pod, calibration float64) (replicaCount int32, usage int64, timestamp time.Time, err error)

GetRawResourceReplicas calculates the desired replica count based on a target resource utilization (as a raw milli-value) for pods matching the given selector in the given namespace, and the current replica count

func (*ReplicaCalculator) GetResourceReplicas

func (c *ReplicaCalculator) GetResourceReplicas(ctx context.Context, currentReplicas int32, targetUtilization int32, resource corev1.ResourceName, namespace string, selector labels.Selector, container string, podList []*corev1.Pod, calibration float64) (replicaCount int32, utilization int32, rawUtilization int64, timestamp time.Time, err error)

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

Directories

Path Synopsis
Package monitor contains metrics which are exposed from the HPA controller.
Package monitor contains metrics which are exposed from the HPA controller.

Jump to

Keyboard shortcuts

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