-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 🐛 fix ignore failed graceful shutdown * 🚀 support node monitoring * 🚀 support node monitoring
- Loading branch information
Showing
14 changed files
with
240 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,5 +11,8 @@ func DefaultConfig() *Config { | |
Interval: 5, | ||
Threshold: 80, | ||
}, | ||
NodeMonitor: NodeMonitor{ | ||
Enabled: true, | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package handler | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/sirupsen/logrus" | ||
corev1 "k8s.io/api/core/v1" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
) | ||
|
||
func (h *handler) ProcessNode(eventType string, obj runtime.Object) { | ||
if obj == nil { | ||
return | ||
} | ||
|
||
node, ok := obj.(*corev1.Node) | ||
if !ok { | ||
logrus.Warnf("failed to cast event to node object: %v", obj) | ||
return | ||
} | ||
|
||
if eventType == "DELETED" { | ||
h.memory.DelNode(node.Name) | ||
return | ||
} | ||
|
||
for _, c := range node.Status.Conditions { | ||
if c.Type == corev1.NodeReady { | ||
if c.Status == corev1.ConditionFalse && !h.memory.HasNode(node.Name) { | ||
logrus.Printf("node %s is not ready: %s", node.Name, c.Reason) | ||
h.alertManager.Notify(fmt.Sprintf("Node %s is not ready: %s - %s", | ||
node.Name, | ||
c.Reason, | ||
c.Message, | ||
)) | ||
h.memory.AddNode(node.Name) | ||
} else if c.Status == corev1.ConditionTrue { | ||
h.memory.DelNode(node.Name) | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.