package metrics
import "k8s.io/kubernetes/pkg/controller/podautoscaler/metrics"
Index ¶
- Constants
- func GetMetricUtilizationRatio(metrics PodMetricsInfo, targetUtilization int64) (utilizationRatio float64, currentUtilization int64)
- func GetResourceUtilizationRatio(metrics PodMetricsInfo, requests map[string]int64, targetUtilization int32) (utilizationRatio float64, currentUtilization int32, rawAverageValue int64, err error)
- type HeapsterMetricsClient
- func (h *HeapsterMetricsClient) GetObjectMetric(metricName string, namespace string, objectRef *autoscaling.CrossVersionObjectReference) (int64, time.Time, error)
- func (h *HeapsterMetricsClient) GetRawMetric(metricName string, namespace string, selector labels.Selector) (PodMetricsInfo, time.Time, error)
- func (h *HeapsterMetricsClient) GetResourceMetric(resource v1.ResourceName, namespace string, selector labels.Selector) (PodMetricsInfo, time.Time, error)
- type MetricsClient
- func NewHeapsterMetricsClient(client clientset.Interface, namespace, scheme, service, port string) MetricsClient
- func NewRESTMetricsClient(resourceClient resourceclient.PodMetricsesGetter, customClient customclient.CustomMetricsClient) MetricsClient
- type PodMetricsInfo
Constants ¶
const ( DefaultHeapsterNamespace = "kube-system" DefaultHeapsterScheme = "http" DefaultHeapsterService = "heapster" DefaultHeapsterPort = "" // use the first exposed port on the service )
Functions ¶
func GetMetricUtilizationRatio ¶
func GetMetricUtilizationRatio(metrics PodMetricsInfo, targetUtilization int64) (utilizationRatio float64, currentUtilization int64)
GetMetricUtilizationRatio takes in a set of metrics and a target utilization value, and calcuates the ratio of desired to actual utilization (returning that and the actual utilization)
func GetResourceUtilizationRatio ¶
func GetResourceUtilizationRatio(metrics PodMetricsInfo, 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 the ratio of desired to actual utilization (returning that, the actual utilization, and the raw average value)
Types ¶
type HeapsterMetricsClient ¶
type HeapsterMetricsClient struct {
// contains filtered or unexported fields
}
func (*HeapsterMetricsClient) GetObjectMetric ¶
func (h *HeapsterMetricsClient) GetObjectMetric(metricName string, namespace string, objectRef *autoscaling.CrossVersionObjectReference) (int64, time.Time, error)
func (*HeapsterMetricsClient) GetRawMetric ¶
func (h *HeapsterMetricsClient) GetRawMetric(metricName string, namespace string, selector labels.Selector) (PodMetricsInfo, time.Time, error)
func (*HeapsterMetricsClient) GetResourceMetric ¶
func (h *HeapsterMetricsClient) GetResourceMetric(resource v1.ResourceName, namespace string, selector labels.Selector) (PodMetricsInfo, time.Time, error)
type MetricsClient ¶
type MetricsClient interface { // GetResourceMetric gets the given resource metric (and an associated oldest timestamp) // for all pods matching the specified selector in the given namespace GetResourceMetric(resource v1.ResourceName, namespace string, selector labels.Selector) (PodMetricsInfo, time.Time, error) // GetRawMetric gets the given metric (and an associated oldest timestamp) // for all pods matching the specified selector in the given namespace GetRawMetric(metricName string, namespace string, selector labels.Selector) (PodMetricsInfo, time.Time, error) // GetObjectMetric gets the given metric (and an associated timestamp) for the given // object in the given namespace GetObjectMetric(metricName string, namespace string, objectRef *autoscaling.CrossVersionObjectReference) (int64, time.Time, error) }
MetricsClient knows how to query a remote interface to retrieve container-level resource metrics as well as pod-level arbitrary metrics
func NewHeapsterMetricsClient ¶
func NewHeapsterMetricsClient(client clientset.Interface, namespace, scheme, service, port string) MetricsClient
func NewRESTMetricsClient ¶
func NewRESTMetricsClient(resourceClient resourceclient.PodMetricsesGetter, customClient customclient.CustomMetricsClient) MetricsClient
type PodMetricsInfo ¶
PodMetricsInfo contains pod metric values as a map from pod names to metric values (the metric values are expected to be the metric as a milli-value)
Source Files ¶
interfaces.go legacy_metrics_client.go rest_metrics_client.go utilization.go
- Version
- v1.8.0-alpha.3
- Published
- Aug 23, 2017
- Platform
- js/wasm
- Imports
- 17 packages
- Last checked
- 47 seconds ago –
Tools for package owners.