replicas

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package replicas provides utilities for getting replica counts from the K8s APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Calculator

type Calculator interface {
	GetUsageRatioReplicaCount(currentReplicas int32, usageRatio float64, readyPodCount int64) int32
	GetPlainMetricReplicaCount(metrics podmetrics.MetricsInfo,
		currentReplicas int32,
		targetUtilization int64,
		readyPodCount int64,
		missingPods,
		ignoredPods sets.String) int32
}

Calculator is used to calculate replica counts

type ReplicaCalculator

type ReplicaCalculator struct {
	Tolerance float64
}

ReplicaCalculator uses a tolerance provided to calculate replica counts for scaling up/down/remaining the same

func (*ReplicaCalculator) GetPlainMetricReplicaCount

func (r *ReplicaCalculator) GetPlainMetricReplicaCount(metrics podmetrics.MetricsInfo,
	currentReplicas int32,
	targetUtilization int64,
	readyPodCount int64,
	missingPods,
	ignoredPods sets.String) int32

GetPlainMetricReplicaCount calculates the replica count based on the metrics of each pod and a target utilization, providing a different replica count if the calculated usage ratio is beyond the tolerance

func (*ReplicaCalculator) GetUsageRatioReplicaCount

func (r *ReplicaCalculator) GetUsageRatioReplicaCount(currentReplicas int32, usageRatio float64, readyPodCount int64) int32

GetUsageRatioReplicaCount calculates the replica count based on the number of replicas, number of ready pods and the usage ratio of the metric - providing a different value if beyond the tolerance

Jump to

Keyboard shortcuts

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