-
Notifications
You must be signed in to change notification settings - Fork 6
/
types.go
118 lines (101 loc) · 5 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
package v1alpha1
import (
_ "github.com/gogo/protobuf/gogoproto"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type TopologyManagerPolicy string
const (
// Constants of type TopologyManagerPolicy represent policy of the worker
// node's resource management component. It's TopologyManager in kubele.
// SingleNUMANodeContainerLevel represent single-numa-node policy of
// the TopologyManager
SingleNUMANodeContainerLevel TopologyManagerPolicy = "SingleNUMANodeContainerLevel"
// SingleNUMANodePodLevel enables pod level resource counting, this policy assumes
// TopologyManager policy single-numa-node also was set on the node
SingleNUMANodePodLevel TopologyManagerPolicy = "SingleNUMANodePodLevel"
// Restricted TopologyManager policy was set on the node
Restricted TopologyManagerPolicy = "Restricted"
// RestrictedContainerLevel TopologyManager policy was set on the node and TopologyManagerScope was set to pod
RestrictedContainerLevel TopologyManagerPolicy = "RestrictedContainerLevel"
// RestrictedPodLevel TopologyManager policy was set on the node and TopologyManagerScope was set to pod
RestrictedPodLevel TopologyManagerPolicy = "RestrictedPodLevel"
// BestEffort TopologyManager policy was set on the node
BestEffort TopologyManagerPolicy = "BestEffort"
// BestEffort TopologyManager policy was set on the node and TopologyManagerScope was set to container
BestEffortContainerLevel TopologyManagerPolicy = "BestEffortContainerLevel"
// BestEffort TopologyManager policy was set on the node and TopologyManagerScope was set to pod
BestEffortPodLevel TopologyManagerPolicy = "BestEffortPodLevel"
// None policy is the default policy and does not perform any topology alignment.
None TopologyManagerPolicy = "None"
)
// +genclient
// +genclient:nonNamespaced
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:resource:scope=Cluster,shortName=node-res-topo
// +kubebuilder:metadata:annotations="api-approved.kubernetes.io=https://github.com/kubernetes/enhancements/pull/1870"
// NodeResourceTopology describes node resources and their topology.
type NodeResourceTopology struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
TopologyPolicies []string `json:"topologyPolicies"`
Zones ZoneList `json:"zones"`
}
// Zone represents a resource topology zone, e.g. socket, node, die or core.
// +protobuf=true
type Zone struct {
Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
Type string `json:"type" protobuf:"bytes,2,opt,name=type"`
Parent string `json:"parent,omitempty" protobuf:"bytes,3,opt,name=parent"`
Costs CostList `json:"costs,omitempty" protobuf:"bytes,4,rep,name=costs"`
Attributes AttributeList `json:"attributes,omitempty" protobuf:"bytes,5,rep,name=attributes"`
Resources ResourceInfoList `json:"resources,omitempty" protobuf:"bytes,6,rep,name=resources"`
}
// ZoneList contains an array of Zone objects.
// +protobuf=true
type ZoneList []Zone
// ResourceInfo contains information about one resource type.
// +protobuf=true
type ResourceInfo struct {
// Name of the resource.
Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
// Capacity of the resource, corresponding to capacity in node status, i.e.
// total amount of this resource that the node has.
Capacity resource.Quantity `json:"capacity" protobuf:"bytes,2,opt,name=capacity"`
// Allocatable quantity of the resource, corresponding to allocatable in
// node status, i.e. total amount of this resource available to be used by
// pods.
Allocatable resource.Quantity `json:"allocatable" protobuf:"bytes,3,opt,name=allocatable"`
// Available is the amount of this resource currently available for new (to
// be scheduled) pods, i.e. Allocatable minus the resources reserved by
// currently running pods.
Available resource.Quantity `json:"available" protobuf:"bytes,4,opt,name=available"`
}
// ResourceInfoList contains an array of ResourceInfo objects.
// +protobuf=true
type ResourceInfoList []ResourceInfo
// CostInfo describes the cost (or distance) between two Zones.
// +protobuf=true
type CostInfo struct {
Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
Value int64 `json:"value" protobuf:"varint,2,opt,name=value"`
}
// CostList contains an array of CostInfo objects.
// +protobuf=true
type CostList []CostInfo
// AttributeInfo contains one attribute of a Zone.
// +protobuf=true
type AttributeInfo struct {
Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
Value string `json:"value" protobuf:"bytes,2,opt,name=value"`
}
// AttributeList contains an array of AttributeInfo objects.
// +protobuf=true
type AttributeList []AttributeInfo
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// NodeResourceTopologyList is a list of NodeResourceTopology resources
type NodeResourceTopologyList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []NodeResourceTopology `json:"items"`
}