mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-07 03:03:59 +00:00
Merge pull request #27038 from wojtek-t/reduce_number_of_logs
Automatic merge from submit-queue Reduce huge amount of logs in large cluster tests When running tests in 2000-node clusters, I got more than 100.000 lines like this: ``` Jun 8 01:03:11.850: INFO: Condition NetworkUnavailable of node gke-gke-large-cluster-default-pool-1-03ee5a12-knrw is true instead of false. Reason: NoRouteCreated, message: Node created w ithout a route ``` that doesn't give much value. This is PR is reducing the number of logs.
This commit is contained in:
commit
7695ae6334
@ -2604,7 +2604,7 @@ func waitListSchedulableNodesOrDie(c *client.Client) *api.NodeList {
|
|||||||
func isNodeSchedulable(node *api.Node) bool {
|
func isNodeSchedulable(node *api.Node) bool {
|
||||||
nodeReady := IsNodeConditionSetAsExpected(node, api.NodeReady, true)
|
nodeReady := IsNodeConditionSetAsExpected(node, api.NodeReady, true)
|
||||||
networkReady := IsNodeConditionUnset(node, api.NodeNetworkUnavailable) ||
|
networkReady := IsNodeConditionUnset(node, api.NodeNetworkUnavailable) ||
|
||||||
IsNodeConditionSetAsExpected(node, api.NodeNetworkUnavailable, false)
|
IsNodeConditionSetAsExpectedSilent(node, api.NodeNetworkUnavailable, false)
|
||||||
return !node.Spec.Unschedulable && nodeReady && networkReady
|
return !node.Spec.Unschedulable && nodeReady && networkReady
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3412,7 +3412,7 @@ func WaitForNodeToBeNotReady(c *client.Client, name string, timeout time.Duratio
|
|||||||
return WaitForNodeToBe(c, name, api.NodeReady, false, timeout)
|
return WaitForNodeToBe(c, name, api.NodeReady, false, timeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsNodeConditionSetAsExpected(node *api.Node, conditionType api.NodeConditionType, wantTrue bool) bool {
|
func isNodeConditionSetAsExpected(node *api.Node, conditionType api.NodeConditionType, wantTrue, silent bool) bool {
|
||||||
// Check the node readiness condition (logging all).
|
// Check the node readiness condition (logging all).
|
||||||
for _, cond := range node.Status.Conditions {
|
for _, cond := range node.Status.Conditions {
|
||||||
// Ensure that the condition type and the status matches as desired.
|
// Ensure that the condition type and the status matches as desired.
|
||||||
@ -3420,16 +3420,28 @@ func IsNodeConditionSetAsExpected(node *api.Node, conditionType api.NodeConditio
|
|||||||
if (cond.Status == api.ConditionTrue) == wantTrue {
|
if (cond.Status == api.ConditionTrue) == wantTrue {
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
Logf("Condition %s of node %s is %v instead of %t. Reason: %v, message: %v",
|
if !silent {
|
||||||
conditionType, node.Name, cond.Status == api.ConditionTrue, wantTrue, cond.Reason, cond.Message)
|
Logf("Condition %s of node %s is %v instead of %t. Reason: %v, message: %v",
|
||||||
|
conditionType, node.Name, cond.Status == api.ConditionTrue, wantTrue, cond.Reason, cond.Message)
|
||||||
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Logf("Couldn't find condition %v on node %v", conditionType, node.Name)
|
if !silent {
|
||||||
|
Logf("Couldn't find condition %v on node %v", conditionType, node.Name)
|
||||||
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func IsNodeConditionSetAsExpected(node *api.Node, conditionType api.NodeConditionType, wantTrue bool) bool {
|
||||||
|
return isNodeConditionSetAsExpected(node, conditionType, wantTrue, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
func IsNodeConditionSetAsExpectedSilent(node *api.Node, conditionType api.NodeConditionType, wantTrue bool) bool {
|
||||||
|
return isNodeConditionSetAsExpected(node, conditionType, wantTrue, true)
|
||||||
|
}
|
||||||
|
|
||||||
func IsNodeConditionUnset(node *api.Node, conditionType api.NodeConditionType) bool {
|
func IsNodeConditionUnset(node *api.Node, conditionType api.NodeConditionType) bool {
|
||||||
for _, cond := range node.Status.Conditions {
|
for _, cond := range node.Status.Conditions {
|
||||||
if cond.Type == conditionType {
|
if cond.Type == conditionType {
|
||||||
|
Loading…
Reference in New Issue
Block a user