mirror of https://github.com/k3s-io/k3s
copy interal ObjectReference to k8s.io/metrics
parent
d23c73687a
commit
074affca6b
|
@ -19,7 +19,7 @@ package custom_metrics
|
|||
import (
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/pkg/api"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
)
|
||||
|
||||
// a list of values for a given metric for some set of objects
|
||||
|
@ -36,7 +36,7 @@ type MetricValue struct {
|
|||
metav1.TypeMeta `json:",inline"`
|
||||
|
||||
// a reference to the described object
|
||||
DescribedObject api.ObjectReference `json:"describedObject"`
|
||||
DescribedObject ObjectReference `json:"describedObject"`
|
||||
|
||||
// the name of the metric
|
||||
MetricName string `json:"metricName"`
|
||||
|
@ -57,3 +57,21 @@ type MetricValue struct {
|
|||
// allObjects is a wildcard used to select metrics
|
||||
// for all objects matching the given label selector
|
||||
const AllObjects = "*"
|
||||
|
||||
// NOTE: ObjectReference is copied from k8s.io/kubernetes/pkg/api/types.go. We
|
||||
// cannot depend on k8s.io/kubernetes/pkg/api because that creates cyclic
|
||||
// dependency between k8s.io/metrics and k8s.io/kubernetes. We cannot depend on
|
||||
// k8s.io/client-go/pkg/api because the package is going to be deprecated soon.
|
||||
// There is no need to keep it an exact copy. Each repo can define its own
|
||||
// internal objects.
|
||||
|
||||
// ObjectReference contains enough information to let you inspect or modify the referred object.
|
||||
type ObjectReference struct {
|
||||
Kind string
|
||||
Namespace string
|
||||
Name string
|
||||
UID types.UID
|
||||
APIVersion string
|
||||
ResourceVersion string
|
||||
FieldPath string
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@ limitations under the License.
|
|||
package metrics
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/pkg/api"
|
||||
)
|
||||
|
||||
// +genclient=true
|
||||
|
@ -37,7 +37,7 @@ type NodeMetrics struct {
|
|||
Window metav1.Duration
|
||||
|
||||
// The memory usage is the memory working set.
|
||||
Usage api.ResourceList
|
||||
Usage ResourceList
|
||||
}
|
||||
|
||||
// NodeMetricsList is a list of NodeMetrics.
|
||||
|
@ -85,5 +85,19 @@ type ContainerMetrics struct {
|
|||
// Container name corresponding to the one from pod.spec.containers.
|
||||
Name string
|
||||
// The memory usage is the memory working set.
|
||||
Usage api.ResourceList
|
||||
Usage ResourceList
|
||||
}
|
||||
|
||||
// NOTE: ResourceName and ResourceList are copied from
|
||||
// k8s.io/kubernetes/pkg/api/types.go. We cannot depend on
|
||||
// k8s.io/kubernetes/pkg/api because that creates cyclic dependency between
|
||||
// k8s.io/metrics and k8s.io/kubernetes. We cannot depend on
|
||||
// k8s.io/client-go/pkg/api because the package is going to be deprecated soon.
|
||||
// There is no need to keep them exact copies. Each repo can define its own
|
||||
// internal objects.
|
||||
|
||||
// ResourceList is a set of (resource name, quantity) pairs.
|
||||
type ResourceList map[ResourceName]resource.Quantity
|
||||
|
||||
// ResourceName is the name identifying various resources in a ResourceList.
|
||||
type ResourceName string
|
||||
|
|
Loading…
Reference in New Issue