Documentation ¶
Index ¶
- func GetMetricUtilizationRatio(metrics podmetrics.MetricsInfo, targetUtilization int64) (utilizationRatio float64, currentUtilization int64)
- func GetResourceUtilizationRatio(metrics podmetrics.MetricsInfo, requests map[string]int64, ...) (utilizationRatio float64, currentUtilization int32, rawAverageValue int64, ...)
- type Client
- type RESTClient
- func (c *RESTClient) GetExternalMetric(metricName, namespace string, selector labels.Selector) ([]int64, time.Time, error)
- func (c *RESTClient) GetObjectMetric(metricName string, namespace string, ...) (int64, time.Time, error)
- func (c *RESTClient) GetRawMetric(metricName string, namespace string, selector labels.Selector, ...) (podmetrics.MetricsInfo, time.Time, error)
- func (c *RESTClient) GetResourceMetric(resource v1.ResourceName, namespace string, selector labels.Selector) (podmetrics.MetricsInfo, time.Time, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetMetricUtilizationRatio ¶
func GetMetricUtilizationRatio(metrics podmetrics.MetricsInfo, targetUtilization int64) (utilizationRatio float64, currentUtilization int64)
GetMetricUtilizationRatio takes in a set of metrics and a target utilization value, and calculates the ratio of desired to actual utilization (returning that and the actual utilization)
func GetResourceUtilizationRatio ¶
func GetResourceUtilizationRatio(metrics podmetrics.MetricsInfo, requests map[string]int64, targetUtilization int32) (utilizationRatio float64, currentUtilization int32, rawAverageValue int64, err error)
GetResourceUtilizationRatio takes in a set of metrics, a set of matching requests, and a target utilization percentage, and calculates the ratio of desired to actual utilization (returning that, the actual utilization, and the raw average value)
Types ¶
type Client ¶
type Client interface { GetResourceMetric(resource v1.ResourceName, namespace string, selector labels.Selector) (podmetrics.MetricsInfo, time.Time, error) GetRawMetric(metricName string, namespace string, selector labels.Selector, metricSelector labels.Selector) (podmetrics.MetricsInfo, time.Time, error) GetObjectMetric(metricName string, namespace string, objectRef *autoscalingv2.CrossVersionObjectReference, metricSelector labels.Selector) (int64, time.Time, error) GetExternalMetric(metricName, namespace string, selector labels.Selector) ([]int64, time.Time, error) }
Client allows for retrieval of Kubernetes metrics
type RESTClient ¶
type RESTClient struct { Client metricsv1beta1.MetricsV1beta1Interface ExternalMetricsClient external_metrics.ExternalMetricsClient CustomMetricsClient custom_metrics.CustomMetricsClient }
RESTClient retrieves Kubernetes metrics through the Kubernetes REST API
func NewClient ¶
func NewClient(clusterConfig *rest.Config, discovery discovery.DiscoveryInterface) *RESTClient
func (*RESTClient) GetExternalMetric ¶
func (c *RESTClient) GetExternalMetric(metricName, namespace string, selector labels.Selector) ([]int64, time.Time, error)
GetExternalMetric gets all the values of a given external metric that match the specified selector.
func (*RESTClient) GetObjectMetric ¶
func (c *RESTClient) GetObjectMetric(metricName string, namespace string, objectRef *autoscalingv2.CrossVersionObjectReference, metricSelector labels.Selector) (int64, time.Time, error)
GetObjectMetric gets the given metric (and an associated timestamp) for the given object in the given namespace
func (*RESTClient) GetRawMetric ¶
func (c *RESTClient) GetRawMetric(metricName string, namespace string, selector labels.Selector, metricSelector labels.Selector) (podmetrics.MetricsInfo, time.Time, error)
GetRawMetric gets the given metric (and an associated oldest timestamp) for all pods matching the specified selector in the given namespace
func (*RESTClient) GetResourceMetric ¶
func (c *RESTClient) GetResourceMetric(resource v1.ResourceName, namespace string, selector labels.Selector) (podmetrics.MetricsInfo, time.Time, error)
GetResourceMetric gets the given resource metric (and an associated oldest timestamp) for all pods matching the specified selector in the given namespace