-
Notifications
You must be signed in to change notification settings - Fork 586
/
types_node.go
130 lines (103 loc) · 5.88 KB
/
types_node.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
119
120
121
122
123
124
125
126
127
128
129
130
package v1
import (
"time"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// +genclient
// +genclient:nonNamespaced
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// Node holds cluster-wide information about node specific features.
//
// Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
// +openshift:compatibility-gen:level=1
// +kubebuilder:resource:path=nodes,scope=Cluster
// +kubebuilder:subresource:status
type Node struct {
metav1.TypeMeta `json:",inline"`
// metadata is the standard object's metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
metav1.ObjectMeta `json:"metadata,omitempty"`
// spec holds user settable values for configuration
// +kubebuilder:validation:Required
// +required
Spec NodeSpec `json:"spec"`
// status holds observed values.
// +optional
Status NodeStatus `json:"status"`
}
type NodeSpec struct {
// CgroupMode determines the cgroups version on the node
// +optional
CgroupMode CgroupMode `json:"cgroupMode,omitempty"`
// WorkerLatencyProfile determins the how fast the kubelet is updating
// the status and corresponding reaction of the cluster
// +optional
WorkerLatencyProfile WorkerLatencyProfileType `json:"workerLatencyProfile,omitempty"`
// EventedPleg enables event based PLEG between the kubelet and the CRI-O
// +openshift:enable:FeatureSets=TechPreviewNoUpgrade
// +optional
EventedPleg EventedPLEG `json:"eventedPleg,omitempty"`
}
type NodeStatus struct{}
// +kubebuilder:validation:Enum=v1;v2;""
type CgroupMode string
const (
CgroupModeEmpty CgroupMode = "" // Empty string indicates to honor user set value on the system that should not be overridden by OpenShift
CgroupModeV1 CgroupMode = "v1"
CgroupModeV2 CgroupMode = "v2"
CgroupModeDefault CgroupMode = CgroupModeV1
)
// +kubebuilder:validation:Enum=Default;MediumUpdateAverageReaction;LowUpdateSlowReaction
type WorkerLatencyProfileType string
const (
// Medium Kubelet Update Frequency (heart-beat) and Average Reaction Time to unresponsive Node
MediumUpdateAverageReaction WorkerLatencyProfileType = "MediumUpdateAverageReaction"
// Low Kubelet Update Frequency (heart-beat) and Slow Reaction Time to unresponsive Node
LowUpdateSlowReaction WorkerLatencyProfileType = "LowUpdateSlowReaction"
// Default values of relavent Kubelet, Kube Controller Manager and Kube API Server
DefaultUpdateDefaultReaction WorkerLatencyProfileType = "Default"
)
// +kubebuilder:validation:Enum=Enabled;Disabled;""
type EventedPLEG string
const (
// Enabled enables the event based pleg between the kubelet and the cri-o
Enabled EventedPLEG = "Enabled"
// Disabled disables the event based pleg between the kubelet and the cri-o
Disabled EventedPLEG = "Disabled"
)
const (
// DefaultNodeStatusUpdateFrequency refers to the "--node-status-update-frequency" of the kubelet in case of DefaultUpdateDefaultReaction WorkerLatencyProfile type
DefaultNodeStatusUpdateFrequency = 10 * time.Second
// DefaultNodeMonitorGracePeriod refers to the "--node-monitor-grace-period" of the Kube Controller Manager in case of DefaultUpdateDefaultReaction WorkerLatencyProfile type
DefaultNodeMonitorGracePeriod = 40 * time.Second
// DefaultNotReadyTolerationSeconds refers to the "--default-not-ready-toleration-seconds" of the Kube API Server in case of DefaultUpdateDefaultReaction WorkerLatencyProfile type
DefaultNotReadyTolerationSeconds = 300
// DefaultUnreachableTolerationSeconds refers to the "--default-unreachable-toleration-seconds" of the Kube API Server in case of DefaultUpdateDefaultReaction WorkerLatencyProfile type
DefaultUnreachableTolerationSeconds = 300
// MediumNodeStatusUpdateFrequency refers to the "--node-status-update-frequency" of the kubelet in case of MediumUpdateAverageReaction WorkerLatencyProfile type
MediumNodeStatusUpdateFrequency = 20 * time.Second
// MediumNodeMonitorGracePeriod refers to the "--node-monitor-grace-period" of the Kube Controller Manager in case of MediumUpdateAverageReaction WorkerLatencyProfile type
MediumNodeMonitorGracePeriod = 2 * time.Minute
// MediumNotReadyTolerationSeconds refers to the "--default-not-ready-toleration-seconds" of the Kube API Server in case of MediumUpdateAverageReaction WorkerLatencyProfile type
MediumNotReadyTolerationSeconds = 60
// MediumUnreachableTolerationSeconds refers to the "--default-unreachable-toleration-seconds" of the Kube API Server in case of MediumUpdateAverageReaction WorkerLatencyProfile type
MediumUnreachableTolerationSeconds = 60
// LowNodeStatusUpdateFrequency refers to the "--node-status-update-frequency" of the kubelet in case of LowUpdateSlowReaction WorkerLatencyProfile type
LowNodeStatusUpdateFrequency = 1 * time.Minute
// LowNodeMonitorGracePeriod refers to the "--node-monitor-grace-period" of the Kube Controller Manager in case of LowUpdateSlowReaction WorkerLatencyProfile type
LowNodeMonitorGracePeriod = 5 * time.Minute
// LowNotReadyTolerationSeconds refers to the "--default-not-ready-toleration-seconds" of the Kube API Server in case of LowUpdateSlowReaction WorkerLatencyProfile type
LowNotReadyTolerationSeconds = 60
// LowUnreachableTolerationSeconds refers to the "--default-unreachable-toleration-seconds" of the Kube API Server in case of LowUpdateSlowReaction WorkerLatencyProfile type
LowUnreachableTolerationSeconds = 60
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
// +openshift:compatibility-gen:level=1
type NodeList struct {
metav1.TypeMeta `json:",inline"`
// metadata is the standard list's metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
metav1.ListMeta `json:"metadata"`
Items []Node `json:"items"`
}