custom_metrics

package
v1.14.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2019 License: Apache-2.0, Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func PeriodicallyInvalidate added in v1.12.0

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

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

Types

type AvailableAPIsGetter added in v1.12.0

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 added in v1.12.0

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

type CustomMetricsClient interface {
	RootScopedMetricsGetter
	NamespacedMetricsGetter
}

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

func NewForConfig

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 added in v1.12.0

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

NewForVersion returns a new CustomMetricsClient for a particular api version.

func NewForVersionForConfig added in v1.12.0

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 added in v1.12.0

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

MetricConverter knows how to convert between external MetricValue versions.

func NewMetricConverter added in v1.12.0

func NewMetricConverter() *MetricConverter

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

func (*MetricConverter) Codecs added in v1.12.0

Codecs returns the codecs used by this metric converter

func (*MetricConverter) ConvertListOptionsToVersion added in v1.12.0

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 added in v1.12.0

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

ConvertResultToVersion converts a Result to the provided GroupVersion

func (*MetricConverter) Scheme added in v1.12.0

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

Scheme returns the scheme used by this metric converter.

func (*MetricConverter) UnsafeConvertToVersionVia added in v1.12.0

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

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

type NamespacedMetricsGetter interface {
	NamespacedMetrics(namespace string) MetricsInterface
}

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

type RootScopedMetricsGetter

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

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL