1 package v1 2 3 import ( 4 "time" 5 6 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 7 ) 8 9 // +genclient 10 // +genclient:nonNamespaced 11 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 12 13 // Node holds cluster-wide information about node specific features. 14 // 15 // Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). 16 // +openshift:compatibility-gen:level=1 17 // +kubebuilder:resource:path=nodes,scope=Cluster 18 // +kubebuilder:subresource:status 19 type Node struct { 20 metav1.TypeMeta `json:",inline"` 21 22 // metadata is the standard object's metadata. 23 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 24 metav1.ObjectMeta `json:"metadata,omitempty"` 25 26 // spec holds user settable values for configuration 27 // +kubebuilder:validation:Required 28 // +required 29 Spec NodeSpec `json:"spec"` 30 31 // status holds observed values. 32 // +optional 33 Status NodeStatus `json:"status"` 34 } 35 36 type NodeSpec struct { 37 // CgroupMode determines the cgroups version on the node 38 // +optional 39 CgroupMode CgroupMode `json:"cgroupMode,omitempty"` 40 41 // WorkerLatencyProfile determins the how fast the kubelet is updating 42 // the status and corresponding reaction of the cluster 43 // +optional 44 WorkerLatencyProfile WorkerLatencyProfileType `json:"workerLatencyProfile,omitempty"` 45 } 46 47 type NodeStatus struct{} 48 49 // +kubebuilder:validation:Enum=v1;v2;"" 50 type CgroupMode string 51 52 const ( 53 CgroupModeEmpty CgroupMode = "" // Empty string indicates to honor user set value on the system that should not be overridden by OpenShift 54 CgroupModeV1 CgroupMode = "v1" 55 CgroupModeV2 CgroupMode = "v2" 56 CgroupModeDefault CgroupMode = CgroupModeV1 57 ) 58 59 // +kubebuilder:validation:Enum=Default;MediumUpdateAverageReaction;LowUpdateSlowReaction 60 type WorkerLatencyProfileType string 61 62 const ( 63 // Medium Kubelet Update Frequency (heart-beat) and Average Reaction Time to unresponsive Node 64 MediumUpdateAverageReaction WorkerLatencyProfileType = "MediumUpdateAverageReaction" 65 66 // Low Kubelet Update Frequency (heart-beat) and Slow Reaction Time to unresponsive Node 67 LowUpdateSlowReaction WorkerLatencyProfileType = "LowUpdateSlowReaction" 68 69 // Default values of relavent Kubelet, Kube Controller Manager and Kube API Server 70 DefaultUpdateDefaultReaction WorkerLatencyProfileType = "Default" 71 ) 72 73 const ( 74 // DefaultNodeStatusUpdateFrequency refers to the "--node-status-update-frequency" of the kubelet in case of DefaultUpdateDefaultReaction WorkerLatencyProfile type 75 DefaultNodeStatusUpdateFrequency = 10 * time.Second 76 // DefaultNodeMonitorGracePeriod refers to the "--node-monitor-grace-period" of the Kube Controller Manager in case of DefaultUpdateDefaultReaction WorkerLatencyProfile type 77 DefaultNodeMonitorGracePeriod = 40 * time.Second 78 // DefaultNotReadyTolerationSeconds refers to the "--default-not-ready-toleration-seconds" of the Kube API Server in case of DefaultUpdateDefaultReaction WorkerLatencyProfile type 79 DefaultNotReadyTolerationSeconds = 300 80 // DefaultUnreachableTolerationSeconds refers to the "--default-unreachable-toleration-seconds" of the Kube API Server in case of DefaultUpdateDefaultReaction WorkerLatencyProfile type 81 DefaultUnreachableTolerationSeconds = 300 82 83 // MediumNodeStatusUpdateFrequency refers to the "--node-status-update-frequency" of the kubelet in case of MediumUpdateAverageReaction WorkerLatencyProfile type 84 MediumNodeStatusUpdateFrequency = 20 * time.Second 85 // MediumNodeMonitorGracePeriod refers to the "--node-monitor-grace-period" of the Kube Controller Manager in case of MediumUpdateAverageReaction WorkerLatencyProfile type 86 MediumNodeMonitorGracePeriod = 2 * time.Minute 87 // MediumNotReadyTolerationSeconds refers to the "--default-not-ready-toleration-seconds" of the Kube API Server in case of MediumUpdateAverageReaction WorkerLatencyProfile type 88 MediumNotReadyTolerationSeconds = 60 89 // MediumUnreachableTolerationSeconds refers to the "--default-unreachable-toleration-seconds" of the Kube API Server in case of MediumUpdateAverageReaction WorkerLatencyProfile type 90 MediumUnreachableTolerationSeconds = 60 91 92 // LowNodeStatusUpdateFrequency refers to the "--node-status-update-frequency" of the kubelet in case of LowUpdateSlowReaction WorkerLatencyProfile type 93 LowNodeStatusUpdateFrequency = 1 * time.Minute 94 // LowNodeMonitorGracePeriod refers to the "--node-monitor-grace-period" of the Kube Controller Manager in case of LowUpdateSlowReaction WorkerLatencyProfile type 95 LowNodeMonitorGracePeriod = 5 * time.Minute 96 // LowNotReadyTolerationSeconds refers to the "--default-not-ready-toleration-seconds" of the Kube API Server in case of LowUpdateSlowReaction WorkerLatencyProfile type 97 LowNotReadyTolerationSeconds = 60 98 // LowUnreachableTolerationSeconds refers to the "--default-unreachable-toleration-seconds" of the Kube API Server in case of LowUpdateSlowReaction WorkerLatencyProfile type 99 LowUnreachableTolerationSeconds = 60 100 ) 101 102 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 103 104 // Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). 105 // +openshift:compatibility-gen:level=1 106 type NodeList struct { 107 metav1.TypeMeta `json:",inline"` 108 109 // metadata is the standard list's metadata. 110 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 111 metav1.ListMeta `json:"metadata"` 112 113 Items []Node `json:"items"` 114 } 115