Debian Codegraph @

pkg/apis/metrics/types.go

raw
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 metrics
18
19 import (
20 corev1 "k8s.io/api/core/v1"
21 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22 )
23
24 // +genclient
25 // +resourceName=nodes
26 // +genclient:readonly
27 // +genclient:nonNamespaced
28 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
29
30 // NodeMetrics sets resource usage metrics of a node.
31 type NodeMetrics struct {
32 metav1.TypeMeta
33 // Standard object's metadata.
34 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
35 // +optional
36 metav1.ObjectMeta
37
38 // The following fields define time interval from which metrics were
39 // collected from the interval [Timestamp-Window, Timestamp].
40 Timestamp metav1.Time
41 Window metav1.Duration
42
43 // The memory usage is the memory working set.
44 Usage corev1.ResourceList
45 }
46
47 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
48
49 // NodeMetricsList is a list of NodeMetrics.
50 type NodeMetricsList struct {
51 metav1.TypeMeta
52 // Standard list metadata.
53 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
54 metav1.ListMeta
55
56 // List of node metrics.
57 Items []NodeMetrics
58 }
59
60 // +genclient
61 // +resourceName=pods
62 // +genclient:readonly
63 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
64
65 // PodMetrics sets resource usage metrics of a pod.
66 type PodMetrics struct {
67 metav1.TypeMeta
68 // Standard object's metadata.
69 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
70 // +optional
71 metav1.ObjectMeta
72
73 // The following fields define time interval from which metrics were
74 // collected from the interval [Timestamp-Window, Timestamp].
75 Timestamp metav1.Time
76 Window metav1.Duration
77
78 // Metrics for all containers are collected within the same time window.
79 Containers []ContainerMetrics
80 }
81
82 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
83
84 // PodMetricsList is a list of PodMetrics.
85 type PodMetricsList struct {
86 metav1.TypeMeta
87 // Standard list metadata.
88 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
89 metav1.ListMeta
90
91 // List of pod metrics.
92 Items []PodMetrics
93 }
94
95 // ContainerMetrics sets resource usage metrics of a container.
96 type ContainerMetrics struct {
97 // Container name corresponding to the one from pod.spec.containers.
98 Name string
99 // The memory usage is the memory working set.
100 Usage corev1.ResourceList
101 }