This is an automated email from the ASF dual-hosted git repository.
zhongxjian pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-kubernetes.git
The following commit(s) were added to refs/heads/master by this push:
new 95d9f141 [horus] Execute a scripted reboot operation (#412)
95d9f141 is described below
commit 95d9f141683d1fb16138ec791bf7b890d5657035
Author: mfordjody <[email protected]>
AuthorDate: Tue Oct 1 15:09:09 2024 +0800
[horus] Execute a scripted reboot operation (#412)
---
app/horus/core/horuser/node_downtime.go | 1 -
app/horus/core/horuser/node_restart.go | 14 ++++++++++++--
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/app/horus/core/horuser/node_downtime.go
b/app/horus/core/horuser/node_downtime.go
index 3c028786..eea3bc2d 100644
--- a/app/horus/core/horuser/node_downtime.go
+++ b/app/horus/core/horuser/node_downtime.go
@@ -134,7 +134,6 @@ func (h *Horuser) DownTimeNodes(clusterName, addr string) {
nodeIP, err := func() (string, error) {
for _, address := range node.Status.Addresses {
if address.Type == "InternalIP" {
-
return address.Address, nil
}
}
diff --git a/app/horus/core/horuser/node_restart.go
b/app/horus/core/horuser/node_restart.go
index b398eca6..743ea7c0 100644
--- a/app/horus/core/horuser/node_restart.go
+++ b/app/horus/core/horuser/node_restart.go
@@ -23,6 +23,7 @@ import (
"github.com/gammazero/workerpool"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/klog/v2"
+ "os/exec"
"time"
)
@@ -64,8 +65,17 @@ func (h *Horuser) TryRestart(node db.NodeDataInfo) {
klog.Infof("RestartMarker result pass:%v err:%v", pass, err)
if pass {
- msg := fmt.Sprintf("【等待腾空节点后重启就绪】【节点:%v】【日期:%v】【集群:%v】",
node.NodeName, node.FirstDate, node.ClusterName)
+ msg := fmt.Sprintf("【等待宕机节点腾空后重启】【节点:%v】【日期:%v】【集群:%v】",
node.NodeName, node.FirstDate, node.ClusterName)
alert.DingTalkSend(h.cc.NodeDownTime.DingTalk, msg)
- // TODO restart policy
+ // TODO user@password
+ cmd := exec.Command("/bin/bash", "./restart.sh", node.NodeIP)
+ output, err := cmd.CombinedOutput()
+ if err != nil {
+ klog.Errorf("Failed to execute restart.sh script for
node %v: %v", node.NodeName, err)
+ klog.Errorf("Output: %v", string(output))
+ return
+ }
+ klog.Infof("Successfully executed restart.sh for node %v.
Output: %v", node.NodeName, string(output))
+ }
}
}