Debian Codegraph @

pkg/apis/custom_metrics/v1beta1/types.go

raw symbols SCIP
1 /*
2 Copyright 2017 The Kubernetes Authors.
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15 */
16
17 package v1beta1
18
19 import (
20 "k8s.io/api/core/v1"
21 "k8s.io/apimachinery/pkg/api/resource"
22 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
23 )
24
25 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
26
27 // MetricValueList is a list of values for a given metric for some set of objects
28 type MetricValueList struct {
29 metav1.TypeMeta `json:",inline"`
30 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
31
32 // the value of the metric across the described objects
33 Items []MetricValue `json:"items" protobuf:"bytes,2,rep,name=items"`
34 }
35
36 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
37
38 // MetricValue is a metric value for some object
39 type MetricValue struct {
40 metav1.TypeMeta `json:",inline"`
41
42 // a reference to the described object
43 DescribedObject v1.ObjectReference `json:"describedObject" protobuf:"bytes,1,name=describedObject"`
44
45 // the name of the metric
46 MetricName string `json:"metricName" protobuf:"bytes,2,name=metricName"`
47
48 // indicates the time at which the metrics were produced
49 Timestamp metav1.Time `json:"timestamp" protobuf:"bytes,3,name=timestamp"`
50
51 // indicates the window ([Timestamp-Window, Timestamp]) from
52 // which these metrics were calculated, when returning rate
53 // metrics calculated from cumulative metrics (or zero for
54 // non-calculated instantaneous metrics).
55 WindowSeconds *int64 `json:"window,omitempty" protobuf:"bytes,4,opt,name=window"`
56
57 // the value of the metric for this
58 Value resource.Quantity `json:"value" protobuf:"bytes,5,name=value"`
59
60 // selector represents the label selector that could be used to select
61 // this metric, and will generally just be the selector passed in to
62 // the query used to fetch this metric.
63 // When left blank, only the metric's Name will be used to gather metrics.
64 // +optional
65 Selector *metav1.LabelSelector `json:"selector" protobuf:"bytes,6,opt,name=selector"`
66 }
67
68 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
69
70 // MetricListOptions is used to select metrics by their label selectors
71 type MetricListOptions struct {
72 metav1.TypeMeta `json:",inline"`
73
74 // A selector to restrict the list of returned objects by their labels.
75 // Defaults to everything.
76 // +optional
77 LabelSelector string `json:"labelSelector,omitempty" protobuf:"bytes,1,opt,name=labelSelector"`
78
79 // A selector to restrict the list of returned metrics by their labels
80 // +optional
81 MetricLabelSelector string `json:"metricLabelSelector,omitempty" protobuf:"bytes,2,opt,name=metricLabelSelector"`
82 }
83
84 // AllObjects is a wildcard used to select metrics
85 // for all objects matching the given label selector
86 const AllObjects = "*"