Documentation ¶
Index ¶
- Constants
- type FederatedHPAController
- type NormalizationArg
- type ReplicaCalculator
- func (c *ReplicaCalculator) GetMetricReplicas(currentReplicas int32, targetUsage int64, metricName string, namespace string, ...) (replicaCount int32, usage int64, timestamp time.Time, err error)
- func (c *ReplicaCalculator) GetObjectMetricReplicas(currentReplicas int32, targetUsage int64, metricName string, namespace string, ...) (replicaCount int32, usage int64, timestamp time.Time, err error)
- func (c *ReplicaCalculator) GetObjectPerPodMetricReplicas(statusReplicas int32, targetAverageUsage int64, metricName string, ...) (replicaCount int32, usage int64, timestamp time.Time, err error)
- func (c *ReplicaCalculator) GetRawResourceReplicas(ctx context.Context, currentReplicas int32, targetUsage int64, ...) (replicaCount int32, usage int64, timestamp time.Time, err error)
- func (c *ReplicaCalculator) GetResourceReplicas(ctx context.Context, currentReplicas int32, targetUtilization int32, ...) (replicaCount int32, utilization int32, rawUtilization int64, ...)
Constants ¶
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 FederatedHPAController ¶
type FederatedHPAController struct { client.Client ReplicaCalc *ReplicaCalculator ClusterScaleClientSetFunc func(string, client.Client) (*util.ClusterScaleClient, error) RESTMapper meta.RESTMapper EventRecorder record.EventRecorder TypedInformerManager typedmanager.MultiClusterInformerManager HorizontalPodAutoscalerSyncPeroid time.Duration DownscaleStabilisationWindow time.Duration RateLimiterOptions ratelimiterflag.Options // contains filtered or unexported fields }
FederatedHPAController is to sync FederatedHPA.
func (*FederatedHPAController) Reconcile ¶
func (c *FederatedHPAController) Reconcile(ctx context.Context, req controllerruntime.Request) (controllerruntime.Result, error)
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 (*FederatedHPAController) SetupWithManager ¶
func (c *FederatedHPAController) 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.MetricsClient, 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