Documentation ¶
Index ¶
- func NewMetricNotFoundError(resource schema.GroupResource, metricName string) *apierr.StatusError
- func NewMetricNotFoundForError(resource schema.GroupResource, metricName string, resourceName string) *apierr.StatusError
- func NewOperationNotSupportedError(operation string) *apierr.StatusError
- func NewResourceLister(provider CustomMetricsProvider) discovery.APIResourceLister
- type CustomMetricsProvider
- type MetricInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 NewOperationNotSupportedError ¶
func NewOperationNotSupportedError(operation string) *apierr.StatusError
NewOperationNotSupportedError returns a StatusError indicating that the invoked API call is not supported.
func NewResourceLister ¶
func NewResourceLister(provider CustomMetricsProvider) discovery.APIResourceLister
NewResourceLister creates APIResourceLister for provided CustomMetricsProvider.
Types ¶
type CustomMetricsProvider ¶
type CustomMetricsProvider interface { // GetRootScopedMetricByName fetches a particular metric for a particular root-scoped object. GetRootScopedMetricByName(groupResource schema.GroupResource, name string, metricName string) (*custom_metrics.MetricValue, error) // GetRootScopedMetricByName fetches a particular metric for a set of root-scoped objects // matching the given label selector. GetRootScopedMetricBySelector(groupResource schema.GroupResource, selector labels.Selector, metricName string) (*custom_metrics.MetricValueList, error) // GetNamespacedMetricByName fetches a particular metric for a particular namespaced object. GetNamespacedMetricByName(groupResource schema.GroupResource, namespace string, name string, metricName string) (*custom_metrics.MetricValue, error) // GetNamespacedMetricByName fetches a particular metric for a set of namespaced objects // matching the given label selector. GetNamespacedMetricBySelector(groupResource schema.GroupResource, namespace string, selector labels.Selector, metricName string) (*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() []MetricInfo }
CustomMetricsProvider is a soruce 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 MetricInfo ¶
type MetricInfo struct { GroupResource schema.GroupResource Namespaced bool Metric string }
MetricInfo describes a metric for a particular fully-qualified group resource.
func (MetricInfo) Normalized ¶
func (i MetricInfo) Normalized(mapper apimeta.RESTMapper) (normalizedInfo MetricInfo, 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 (MetricInfo) String ¶
func (i MetricInfo) String() string