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:
k8s-merge-robot 2016-06-08 10:29:24 -07:00
commit 7695ae6334

View File

@ -2604,7 +2604,7 @@ func waitListSchedulableNodesOrDie(c *client.Client) *api.NodeList {
func isNodeSchedulable(node *api.Node) bool {
nodeReady := IsNodeConditionSetAsExpected(node, api.NodeReady, true)
networkReady := IsNodeConditionUnset(node, api.NodeNetworkUnavailable) ||
IsNodeConditionSetAsExpected(node, api.NodeNetworkUnavailable, false)
IsNodeConditionSetAsExpectedSilent(node, api.NodeNetworkUnavailable, false)
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)
}
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).
for _, cond := range node.Status.Conditions {
// 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 {
return true
} else {
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)
if !silent {
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
}
}
}
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
}
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 {
for _, cond := range node.Status.Conditions {
if cond.Type == conditionType {