mirror of
https://github.com/kubernetes/node-problem-detector.git
synced 2026-03-02 09:40:29 +00:00
Merge pull request #678 from 2rs2ts/master
Add condition message to event message
This commit is contained in:
@@ -232,6 +232,7 @@ func (c *customPluginMonitor) generateStatus(result cpmtypes.Result) *types.Stat
|
||||
condition.Type,
|
||||
status,
|
||||
newReason,
|
||||
newMessage,
|
||||
timestamp,
|
||||
)
|
||||
|
||||
|
||||
@@ -192,6 +192,7 @@ func (l *logMonitor) generateStatus(logs []*logtypes.Log, rule systemlogtypes.Ru
|
||||
condition.Type,
|
||||
types.True,
|
||||
rule.Reason,
|
||||
message,
|
||||
timestamp,
|
||||
))
|
||||
}
|
||||
|
||||
@@ -84,6 +84,7 @@ func TestGenerateStatusForConditions(t *testing.T) {
|
||||
testConditionA,
|
||||
types.True,
|
||||
"test reason",
|
||||
"test message 1\ntest message 2",
|
||||
time.Unix(1000, 1000),
|
||||
)},
|
||||
Conditions: []types.Condition{
|
||||
|
||||
@@ -23,12 +23,12 @@ import (
|
||||
)
|
||||
|
||||
// GenerateConditionChangeEvent generates an event for condition change.
|
||||
func GenerateConditionChangeEvent(t string, status types.ConditionStatus, reason string, timestamp time.Time) types.Event {
|
||||
func GenerateConditionChangeEvent(t string, status types.ConditionStatus, reason, message string, timestamp time.Time) types.Event {
|
||||
return types.Event{
|
||||
Severity: types.Info,
|
||||
Timestamp: timestamp,
|
||||
Reason: reason,
|
||||
Message: fmt.Sprintf("Node condition %s is now: %s, reason: %s", t, status, reason),
|
||||
Message: fmt.Sprintf("Node condition %s is now: %s, reason: %s, message: %q", t, status, reason, message),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user