Documentation
¶
Index ¶
- type Evaluator
- func (e *Evaluator) Evaluate(gatheredMetrics []*metrics.Metric, currentReplicas int32) (int32, error)
- func (e *Evaluator) EvaluateSingleMetric(gatheredMetric *metrics.Metric, currentReplicas int32) (int32, error)
- func (e *Evaluator) EvaluateSingleMetricWithOptions(gatheredMetric *metrics.Metric, currentReplicas int32, tolerance float64) (int32, error)
- func (e *Evaluator) EvaluateWithOptions(gatheredMetrics []*metrics.Metric, currentReplicas int32, tolerance float64) (int32, error)
- type ExternalEvaluater
- type ExternalGatherer
- type Gatherer
- func (c *Gatherer) Gather(specs []autoscalingv2.MetricSpec, namespace string, ...) ([]*metrics.Metric, error)
- func (c *Gatherer) GatherSingleMetric(spec autoscalingv2.MetricSpec, namespace string, podSelector labels.Selector) (*metrics.Metric, error)
- func (c *Gatherer) GatherSingleMetricWithOptions(spec autoscalingv2.MetricSpec, namespace string, podSelector labels.Selector, ...) (*metrics.Metric, error)
- func (c *Gatherer) GatherWithOptions(specs []autoscalingv2.MetricSpec, namespace string, ...) ([]*metrics.Metric, error)
- type ObjectEvaluater
- type ObjectGatherer
- type PodsEvaluater
- type PodsGatherer
- type ResourceEvaluater
- type ResourceGatherer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Evaluator ¶
type Evaluator struct { External ExternalEvaluater Object ObjectEvaluater Pods PodsEvaluater Resource ResourceEvaluater Tolerance float64 }
Evaluator provides functionality for deciding how many replicas a resource should have based on provided metrics.
func NewEvaluator ¶
NewEvaluator sets up an evaluate that can process external, object, pod and resource metrics
func (*Evaluator) EvaluateSingleMetric ¶
type ExternalEvaluater ¶
type ExternalEvaluater interface {
Evaluate(currentReplicas int32, gatheredMetric *metrics.Metric, tolerance float64) (int32, error)
}
ExternalEvaluater produces a replica count based on an external metric provided
type ExternalGatherer ¶
type ExternalGatherer interface { Gather(metricName, namespace string, metricSelector *metav1.LabelSelector, podSelector labels.Selector) (*externalmetrics.Metric, error) GatherPerPod(metricName, namespace string, metricSelector *metav1.LabelSelector) (*externalmetrics.Metric, error) }
ExternalGatherer allows retrieval of external metrics.
type Gatherer ¶
type Gatherer struct { Resource ResourceGatherer Pods PodsGatherer Object ObjectGatherer External ExternalGatherer ScaleClient k8sscale.ScalesGetter CPUInitializationPeriod time.Duration DelayOfInitialReadinessStatus time.Duration }
Gatherer provides functionality for retrieving metrics on supplied metric specs.
func NewGatherer ¶
func NewGatherer( metricsclient metricsclient.Client, podlister corelisters.PodLister, cpuInitializationPeriod time.Duration, delayOfInitialReadinessStatus time.Duration) *Gatherer
NewGatherer sets up a new Metric Gatherer
func (*Gatherer) Gather ¶
func (c *Gatherer) Gather(specs []autoscalingv2.MetricSpec, namespace string, podSelector labels.Selector) ([]*metrics.Metric, error)
func (*Gatherer) GatherSingleMetric ¶
func (c *Gatherer) GatherSingleMetric(spec autoscalingv2.MetricSpec, namespace string, podSelector labels.Selector) (*metrics.Metric, error)
func (*Gatherer) GatherSingleMetricWithOptions ¶ added in v1.1.0
func (c *Gatherer) GatherSingleMetricWithOptions(spec autoscalingv2.MetricSpec, namespace string, podSelector labels.Selector, cpuInitializationPeriod time.Duration, delayOfInitialReadinessStatus time.Duration) (*metrics.Metric, error)
GatherSingleMetric returns the metric gathered based on a single metric spec.
func (*Gatherer) GatherWithOptions ¶ added in v1.1.0
func (c *Gatherer) GatherWithOptions(specs []autoscalingv2.MetricSpec, namespace string, podSelector labels.Selector, cpuInitializationPeriod time.Duration, delayOfInitialReadinessStatus time.Duration) ([]*metrics.Metric, error)
Gather returns all of the metrics gathered based on the metric specs provided.
type ObjectEvaluater ¶
type ObjectEvaluater interface {
Evaluate(currentReplicas int32, gatheredMetric *metrics.Metric, tolerance float64) (int32, error)
}
ObjectEvaluater produces a replica count based on an object metric provided
type ObjectGatherer ¶
type ObjectGatherer interface { Gather(metricName string, namespace string, objectRef *autoscalingv2.CrossVersionObjectReference, podSelector labels.Selector, metricSelector labels.Selector) (*objectmetrics.Metric, error) GatherPerPod(metricName string, namespace string, objectRef *autoscalingv2.CrossVersionObjectReference, metricSelector labels.Selector) (*objectmetrics.Metric, error) }
ObjectGatherer allows retrieval of object metrics.
type PodsEvaluater ¶
type PodsEvaluater interface {
Evaluate(currentReplicas int32, gatheredMetric *metrics.Metric) int32
}
PodsEvaluater produces a replica count based on a pods metric provided
type PodsGatherer ¶
type PodsGatherer interface {
Gather(metricName string, namespace string, podSelector labels.Selector, metricSelector labels.Selector) (*podsmetrics.Metric, error)
}
PodsGatherer allows retrieval of pods metrics.
type ResourceEvaluater ¶
type ResourceEvaluater interface {
Evaluate(currentReplicas int32, gatheredMetric *metrics.Metric, tolerance float64) (int32, error)
}
ResourceEvaluater produces an evaluation based on a resource metric provided
type ResourceGatherer ¶
type ResourceGatherer interface { Gather(resourceName corev1.ResourceName, namespace string, podSelector labels.Selector, cpuInitializationPeriod time.Duration, delayOfInitialReadinessStatus time.Duration) (*resourcemetrics.Metric, error) GatherRaw(resourceName corev1.ResourceName, namespace string, podSelector labels.Selector, cpuInitializationPeriod time.Duration, delayOfInitialReadinessStatus time.Duration) (*resourcemetrics.Metric, error) }
ResourceGatherer allows retrieval of resource metrics.
Directories
¶
Path | Synopsis |
---|---|
examples
|
|
cpuandmemoryreplicaprint
Module
|
|
cpuprint
Module
|
|
cpureplicaprint
Module
|
|
internal
|
|
fake
Package fake provides stubs for testing relevant to the Custom Pod Autoscaler packages
|
Package fake provides stubs for testing relevant to the Custom Pod Autoscaler packages |
Package podsclient provides an on-demand client for retrieving pods, without using caching, as the HorizontalPodAutoscaler does.
|
Package podsclient provides an on-demand client for retrieving pods, without using caching, as the HorizontalPodAutoscaler does. |