Merge pull request #678 from 2rs2ts/master

Add condition message to event message
This commit is contained in:
Kubernetes Prow Robot
2022-06-15 15:43:11 -07:00
committed by GitHub
4 changed files with 5 additions and 2 deletions

View File

@@ -232,6 +232,7 @@ func (c *customPluginMonitor) generateStatus(result cpmtypes.Result) *types.Stat
condition.Type,
status,
newReason,
newMessage,
timestamp,
)

View File

@@ -192,6 +192,7 @@ func (l *logMonitor) generateStatus(logs []*logtypes.Log, rule systemlogtypes.Ru
condition.Type,
types.True,
rule.Reason,
message,
timestamp,
))
}

View File

@@ -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{

View File

@@ -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),
}
}