Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ type Config struct {

// IgnoreNodeReasons is an optional list of node reasons for which alerting should be skipped
IgnoreNodeReasons []string `yaml:"ignoreNodeReasons"`
// IgnoreNodeMessages is an optional list of node messages for which alerting should be skipped
IgnoreNodeMessages []string `yaml:"ignoreNodeMessages"`
}

// App confing struct
Expand Down
10 changes: 9 additions & 1 deletion handler/processNode.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package handler

import (
"fmt"
"strings"
"github.com/sirupsen/logrus"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
Expand Down Expand Up @@ -30,7 +31,14 @@ func (h *handler) ProcessNode(eventType string, obj runtime.Object) {
// Skip alert if Reason is in IgnoreNodeReasons
for _, ignoreReason := range h.config.IgnoreNodeReasons {
if c.Reason == ignoreReason {
logrus.Printf("Skipping Notify for node %s due to ignored reason: %s", node.Name, c.Reason)
logrus.Debugf("Skipping Notify for node %s due to ignored reason: %s", node.Name, c.Reason)
return
}
}
// Skip alert if Message matches in IgnoreNodeMessages
for _, ignoreMessage := range h.config.IgnoreNodeMessages {
if strings.Contains(c.Message, ignoreMessage) {
logrus.Debugf("Skipping Notify for node %s due to ignored message: %s", node.Name, c.Message)
return
}
}
Expand Down