Debian Codegraph @

pkg/apis/metrics/v1alpha1/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 v1alpha1
18
19 import (
20 v1 "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 `json:",inline"`
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 `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
37
38 // The following fields define time interval from which metrics were
39 // collected from the interval [Timestamp-Window, Timestamp].
40 Timestamp metav1.Time `json:"timestamp" protobuf:"bytes,2,opt,name=timestamp"`
41 Window metav1.Duration `json:"window" protobuf:"bytes,3,opt,name=window"`
42
43 // The memory usage is the memory working set.
44 Usage v1.ResourceList `json:"usage" protobuf:"bytes,4,rep,name=usage,casttype=k8s.io/api/core/v1.ResourceList,castkey=k8s.io/api/core/v1.ResourceName,castvalue=k8s.io/apimachinery/pkg/api/resource.Quantity"`
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 `json:",inline"`
52 // Standard list metadata.
53 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
54 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
55
56 // List of node metrics.
57 Items []NodeMetrics `json:"items" protobuf:"bytes,2,rep,name=items"`
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 `json:",inline"`
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 `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
72
73 // The following fields define time interval from which metrics were
74 // collected from the interval [Timestamp-Window, Timestamp].
75 Timestamp metav1.Time `json:"timestamp" protobuf:"bytes,2,opt,name=timestamp"`
76 Window metav1.Duration `json:"window" protobuf:"bytes,3,opt,name=window"`
77
78 // Metrics for all containers are collected within the same time window.
79 // +listType=atomic
80 Containers []ContainerMetrics `json:"containers" protobuf:"bytes,4,rep,name=containers"`
81 }
82
83 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
84
85 // PodMetricsList is a list of PodMetrics.
86 type PodMetricsList struct {
87 metav1.TypeMeta `json:",inline"`
88 // Standard list metadata.
89 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
90 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
91
92 // List of pod metrics.
93 Items []PodMetrics `json:"items" protobuf:"bytes,2,rep,name=items"`
94 }
95
96 // ContainerMetrics sets resource usage metrics of a container.
97 type ContainerMetrics struct {
98 // Container name corresponding to the one from pod.spec.containers.
99 Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
100 // The memory usage is the memory working set.
101 Usage v1.ResourceList `json:"usage" protobuf:"bytes,2,rep,name=usage,casttype=k8s.io/api/core/v1.ResourceList,castkey=k8s.io/api/core/v1.ResourceName,castvalue=k8s.io/apimachinery/pkg/api/resource.Quantity"`
102 }