metrics: k8s.io/metrics/pkg/client/custom_metrics Index | Files | Directories

package custom_metrics

import "k8s.io/metrics/pkg/client/custom_metrics"

Index

Package Files

converter.go discovery.go interfaces.go multi_client.go versioned_client.go

Variables

var (
    // MetricVersions is the set of metric versions accepted by the converter.
    MetricVersions = []schema.GroupVersion{
        cmv1beta2.SchemeGroupVersion,
        cmv1beta1.SchemeGroupVersion,
        cmint.SchemeGroupVersion,
    }
)

func PeriodicallyInvalidate Uses

func PeriodicallyInvalidate(cache AvailableAPIsGetter, interval time.Duration, stopCh <-chan struct{})

PeriodicallyInvalidate periodically invalidates the preferred version cache until told to stop.

type AvailableAPIsGetter Uses

type AvailableAPIsGetter interface {
    PreferredVersion() (schema.GroupVersion, error)
    Invalidate()
}

AvailableAPIsGetter knows how to fetch and cache the preferred custom metrics API version, and invalidate that cache when asked.

func NewAvailableAPIsGetter Uses

func NewAvailableAPIsGetter(client discovery.DiscoveryInterface) AvailableAPIsGetter

NewAvailableAPIsGetter creates an AvailableAPIsGetter that checks discovery to find the available versions of the custom metrics api.

type CustomMetricsClient Uses

type CustomMetricsClient interface {
    RootScopedMetricsGetter
    NamespacedMetricsGetter
}

CustomMetricsClient is a client for fetching metrics describing both root-scoped and namespaced resources.

func NewForConfig Uses

func NewForConfig(baseConfig *rest.Config, mapper meta.RESTMapper, availableAPIs AvailableAPIsGetter) CustomMetricsClient

NewForConfig creates a new custom metrics client which delegates to a client which uses the preferred api version.

func NewForVersion Uses

func NewForVersion(client rest.Interface, mapper meta.RESTMapper, version schema.GroupVersion) CustomMetricsClient

NewForVersion returns a new CustomMetricsClient for a particular api version.

func NewForVersionForConfig Uses

func NewForVersionForConfig(c *rest.Config, mapper meta.RESTMapper, version schema.GroupVersion) (CustomMetricsClient, error)

NewForVersionForConfig returns a new CustomMetricsClient for a particular api version and base configuration.

type MetricConverter Uses

type MetricConverter struct {
    // contains filtered or unexported fields
}

MetricConverter knows how to convert between external MetricValue versions.

func NewMetricConverter Uses

func NewMetricConverter() *MetricConverter

NewMetricConverter creates a MetricConverter which knows how to convert objects between different versions of the custom metrics api.

func (*MetricConverter) Codecs Uses

func (c *MetricConverter) Codecs() serializer.CodecFactory

Codecs returns the codecs used by this metric converter

func (*MetricConverter) ConvertListOptionsToVersion Uses

func (c *MetricConverter) ConvertListOptionsToVersion(opts *cmint.MetricListOptions, version schema.GroupVersion) (runtime.Object, error)

ConvertListOptionsToVersion converts converts a set of MetricListOptions to the provided GroupVersion.

func (*MetricConverter) ConvertResultToVersion Uses

func (c *MetricConverter) ConvertResultToVersion(res rest.Result, gv schema.GroupVersion) (runtime.Object, error)

ConvertResultToVersion converts a Result to the provided GroupVersion

func (*MetricConverter) Scheme Uses

func (c *MetricConverter) Scheme() *runtime.Scheme

Scheme returns the scheme used by this metric converter.

func (*MetricConverter) UnsafeConvertToVersionVia Uses

func (c *MetricConverter) UnsafeConvertToVersionVia(obj runtime.Object, externalVersion schema.GroupVersion) (runtime.Object, error)

unsafeConvertToVersionVia is like Scheme.UnsafeConvertToVersion, but it does so via an internal version first. We use it here to work with the v1beta2 client internally, while preserving backwards compatibility for existing custom metrics adapters

type MetricsInterface Uses

type MetricsInterface interface {
    // GetForObject fetchs the given metric describing the given object.
    GetForObject(groupKind schema.GroupKind, name string, metricName string, metricSelector labels.Selector) (*v1beta2.MetricValue, error)

    // GetForObjects fetches the given metric describing all objects of the given
    // type matching the given label selector (or simply all objects of the given type
    // if the selector is nil).
    GetForObjects(groupKind schema.GroupKind, selector labels.Selector, metricName string, metricSelector labels.Selector) (*v1beta2.MetricValueList, error)
}

MetricsInterface provides access to metrics describing Kubernetes objects.

type NamespacedMetricsGetter Uses

type NamespacedMetricsGetter interface {
    NamespacedMetrics(namespace string) MetricsInterface
}

NamespacedMetricsGetter provides access to an interface for fetching metrics describing resources in a particular namespace.

type RootScopedMetricsGetter Uses

type RootScopedMetricsGetter interface {
    RootScopedMetrics() MetricsInterface
}

RootScopedMetricsGetter provides access to an interface for fetching metrics describing root-scoped objects. Note that metrics describing a namespace are simply considered a special case of root-scoped metrics.

Directories

PathSynopsis
fake
scheme

Package custom_metrics imports 17 packages (graph) and is imported by 59 packages. Updated 2019-08-07. Refresh now. Tools for package owners.