Skip to content

Commit 6a2d6b7

Browse files
author
Sedef
committed
Address comments
1 parent a2083cf commit 6a2d6b7

File tree

3 files changed

+13
-26
lines changed

3 files changed

+13
-26
lines changed

api/v1alpha3/condition_consts.go

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ const (
126126
)
127127

128128
// Conditions and condition Reasons for the Machine's Node object
129-
130129
const (
131130
// MachineNodeHealthyCondition provides info about the operational state of the Kubernetes node hosted on the machine by summarizing node conditions.
132131
// If the conditions defined in a Kubernetes node (i.e., NodeReady, NodeMemoryPressure, NodeDiskPressure, NodePIDPressure, and NodeNetworkUnavailable) are in a healthy state, it will be set to True.
@@ -143,22 +142,3 @@ const (
143142
// NodeConditionsFailedReason (Severity=Warning) documents a node is not in a healthy state due to the failed state of at least 1 Kubelet condition.
144143
NodeConditionsFailedReason = "NodeConditionsFailed"
145144
)
146-
147-
// Common Pod-related Condition Reasons used by Pod-related Conditions.
148-
const (
149-
// PodProvisioningReason (Severity=Info) documents a pod waiting to be provisioned i.e., Pod is in "Pending" phase and
150-
// PodScheduled and Initialized conditions are not set to True yet.
151-
PodProvisioningReason = "PodProvisioning"
152-
153-
// PodProvisioningReason (Severity=Warning) documents a pod failed during provisioning i.e., Pod is in "Pending" phase and
154-
// PodScheduled and Initialized conditions are set to True,
155-
// but ContainersReady or Ready condition is false (i.e., at least one of the containers are in waiting state(e.g CrashLoopbackOff, ImagePullBackOff)
156-
PodProvisioningFailedReason = "PodProvisioningFailed"
157-
158-
// PodMissingReason (Severity=Warning) documents a pod does not exist.
159-
PodMissingReason = "PodMissing"
160-
161-
// PodFailedReason (Severity=Error) documents a pod's at least one container has terminated in a failure
162-
// and hence Pod is in "Failed" phase.
163-
PodFailedReason = "PodFailed"
164-
)

controllers/machine_controller_noderef.go renamed to controllers/machine_controller_node.go

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,21 @@ func (r *MachineReconciler) reconcileNode(ctx context.Context, cluster *clusterv
104104
return nil
105105
}
106106

107-
// Return true if all Node Conditions are false other than "Ready" condition.
108-
// "Ready" being false does not mean there is a problem with the Node, may be missing CNI.
107+
// checkNodeConditions checks if a Node is healthy and does not have any semantically negative Conditions.
108+
// Returns true if NodeMemoryPressure, NodeDiskPressure, or NodePIDPressure Conditions are false or Ready Condition is true.
109109
func checkNodeConditions(node *apicorev1.Node) bool {
110110
for _, condition := range node.Status.Conditions {
111-
if condition.Type != apicorev1.NodeReady {
112-
if condition.Status == apicorev1.ConditionTrue {
113-
return false
114-
}
111+
if condition.Type == apicorev1.NodeMemoryPressure && condition.Status == apicorev1.ConditionTrue{
112+
return false
113+
}
114+
if condition.Type == apicorev1.NodeDiskPressure && condition.Status == apicorev1.ConditionTrue{
115+
return false
116+
}
117+
if condition.Type == apicorev1.NodePIDPressure && condition.Status == apicorev1.ConditionTrue{
118+
return false
119+
}
120+
if condition.Type == apicorev1.NodeReady && condition.Status == apicorev1.ConditionFalse{
121+
return false
115122
}
116123
}
117124
return true

0 commit comments

Comments
 (0)