provider

package
v0.0.0-...-4b56dc5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCustomMetricResourceLister

func NewCustomMetricResourceLister(provider CustomMetricsProvider) discovery.APIResourceLister

NewCustomMetricResourceLister creates APIResourceLister for provided CustomMetricsProvider.

func NewExternalMetricResourceLister

func NewExternalMetricResourceLister(provider ExternalMetricsProvider) discovery.APIResourceLister

NewExternalMetricResourceLister creates APIResourceLister for provided CustomMetricsProvider.

func NewMetricNotFoundError

func NewMetricNotFoundError(resource schema.GroupResource, metricName string) *apierr.StatusError

NewMetricNotFoundError returns a StatusError indicating the given metric could not be found. It is similar to NewNotFound, but more specialized

func NewMetricNotFoundForError

func NewMetricNotFoundForError(resource schema.GroupResource, metricName string, resourceName string) *apierr.StatusError

NewMetricNotFoundForError returns a StatusError indicating the given metric could not be found for the given named object. It is similar to NewNotFound, but more specialized

func NewMetricNotFoundForSelectorError

func NewMetricNotFoundForSelectorError(resource schema.GroupResource, metricName string, resourceName string, selector labels.Selector) *apierr.StatusError

NewMetricNotFoundForError returns a StatusError indicating the given metric could not be found for the given named object. It is similar to NewNotFound, but more specialized

Types

type CustomMetricInfo

type CustomMetricInfo struct {
	GroupResource schema.GroupResource
	Namespaced    bool
	Metric        string
}

CustomMetricInfo describes a metric for a particular fully-qualified group resource.

func (CustomMetricInfo) Normalized

func (i CustomMetricInfo) Normalized(mapper apimeta.RESTMapper) (normalizedInfo CustomMetricInfo, singluarResource string, err error)

Normalized returns a copy of the current MetricInfo with the GroupResource resolved using the provided REST mapper, to ensure consistent pluralization, etc, for use when looking up or comparing the MetricInfo. It also returns the singular form of the GroupResource associated with the given MetricInfo.

func (CustomMetricInfo) String

func (i CustomMetricInfo) String() string

type CustomMetricsProvider

type CustomMetricsProvider interface {
	// GetMetricByName fetches a particular metric for a particular object.
	// The namespace will be empty if the metric is root-scoped.
	GetMetricByName(name types.NamespacedName, info CustomMetricInfo, metricSelector labels.Selector) (*custom_metrics.MetricValue, error)

	// GetMetricBySelector fetches a particular metric for a set of objects matching
	// the given label selector.  The namespace will be empty if the metric is root-scoped.
	GetMetricBySelector(namespace string, selector labels.Selector, info CustomMetricInfo, metricSelector labels.Selector) (*custom_metrics.MetricValueList, error)

	// ListAllMetrics provides a list of all available metrics at
	// the current time.  Note that this is not allowed to return
	// an error, so it is reccomended that implementors cache and
	// periodically update this list, instead of querying every time.
	ListAllMetrics() []CustomMetricInfo
}

CustomMetricsProvider is a source of custom metrics which is able to supply a list of available metrics, as well as metric values themselves on demand.

Note that group-resources are provided as GroupResources, not GroupKinds. This is to allow flexibility on the part of the implementor: implementors do not necessarily need to be aware of all existing kinds and their corresponding REST mappings in order to perform queries.

For queries that use label selectors, it is up to the implementor to decide how to make use of the label selector -- they may wish to query the main Kubernetes API server, or may wish to simply make use of stored information in their TSDB.

type ExternalMetricInfo

type ExternalMetricInfo struct {
	Metric string
}

ExternalMetricInfo describes a metric.

type ExternalMetricsProvider

type ExternalMetricsProvider interface {
	GetExternalMetric(namespace string, metricSelector labels.Selector, info ExternalMetricInfo) (*external_metrics.ExternalMetricValueList, error)

	ListAllExternalMetrics() []ExternalMetricInfo
}

ExternalMetricsProvider is a source of external metrics. Metric is normally identified by a name and a set of labels/tags. It is up to a specific implementation how to translate metricSelector to a filter for metric values. Namespace can be used by the implemetation for metric identification, access control or ignored.

type MetricsProvider

type MetricsProvider interface {
	CustomMetricsProvider
	ExternalMetricsProvider
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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