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 9867e01b [horus] Organize yaml and refine configuration (#420)
9867e01b is described below

commit 9867e01bda19aa51aa30aff46f7a42fe1b2006e2
Author: mfordjody <[email protected]>
AuthorDate: Thu Oct 3 12:12:49 2024 +0800

    [horus] Organize yaml and refine configuration (#420)
---
 app/horus/base/config/config.go    |  3 ++-
 app/horus/core/alerter/dingtalk.go |  2 +-
 app/horus/core/alerter/slack.go    |  2 +-
 manifests/horus/horus.yaml         | 26 +++++++++++++++++---------
 4 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/app/horus/base/config/config.go b/app/horus/base/config/config.go
index 74f1b42e..846dbf2a 100644
--- a/app/horus/base/config/config.go
+++ b/app/horus/base/config/config.go
@@ -43,6 +43,7 @@ type DingTalkConfiguration struct {
 
 type SlackConfiguration struct {
        WebhookUrl string `yaml:"webhookUrl"`
+       Title      string `yaml:"title"`
 }
 
 type RecoveryConfiguration struct {
@@ -56,7 +57,7 @@ type RecoveryConfiguration struct {
 
 type ModularConfiguration struct {
        Enabled             bool                   `yaml:"enabled"`
-       CordonDailyLimit    map[string]int         `yaml:"cordonDailyLimit"`
+       dailyLimit          map[string]int         `yaml:"dailyLimit"`
        AbnormalityQL       map[string]string      `yaml:"abnormalityQL"`
        RecoveryQL          map[string]string      `yaml:"recoveryQL"`
        IntervalSecond      int                    `yaml:"intervalSecond"`
diff --git a/app/horus/core/alerter/dingtalk.go 
b/app/horus/core/alerter/dingtalk.go
index 8194e66c..d62ac7b9 100644
--- a/app/horus/core/alerter/dingtalk.go
+++ b/app/horus/core/alerter/dingtalk.go
@@ -54,7 +54,7 @@ type Message struct {
 
 func DingTalkSend(dk *config.DingTalkConfiguration, msg string) {
        dtm := Message{MsgType: "text"}
-       dtm.Text.Content = fmt.Sprint(DingTalkTitle, msg)
+       dtm.Text.Content = fmt.Sprint(dk.Title, msg)
        dtm.At.AtMobiles = dk.AtMobiles
        bs, err := json.Marshal(dtm)
        if err != nil {
diff --git a/app/horus/core/alerter/slack.go b/app/horus/core/alerter/slack.go
index 118036fb..ec1a3b47 100644
--- a/app/horus/core/alerter/slack.go
+++ b/app/horus/core/alerter/slack.go
@@ -33,7 +33,7 @@ type Text struct {
 func SlackSend(sk *config.SlackConfiguration, channel string) {
        skm := Text{Text: "text"}
        skm.Text = fmt.Sprintf("%s"+
-               "%v", SlackTitle, channel)
+               "%v", sk.Title, channel)
        bs, err := json.Marshal(skm)
        if err != nil {
                klog.Errorf("slack json marshal err:%v\n dtm:%v\n", err, skm)
diff --git a/manifests/horus/horus.yaml b/manifests/horus/horus.yaml
index 7a11207e..14225bbb 100644
--- a/manifests/horus/horus.yaml
+++ b/manifests/horus/horus.yaml
@@ -34,15 +34,16 @@ nodeRecovery:
   promQueryTimeSecond: 60
   dingTalk:
     webhookUrl: 
"https://oapi.dingtalk.com/robot/send?access_token=37f8891e60e524013275cc01efafdb5976b81ef7269ce271b769bcd025826c12";
-    title: "horus 通知"
+    title: "自定义通知"
     atMobiles:
-      - 15000000
+      - 15000000000
   slack:
     webhookUrl: 
"https://hooks.slack.com/services/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";
+    title: "自定义通知"
 
 customModular:
   enabled: false
-  cordonDailyLimit:
+  dailyLimit:
     node_cpu: 1
   abnormalityQL:
     node_cpu: |-
@@ -56,11 +57,12 @@ customModular:
     cluster: config.1
   dingTalk:
     webhookUrl: 
"https://oapi.dingtalk.com/robot/send?access_token=37f8891e60e524013275cc01efafdb5976b81ef7269ce271b769bcd025826c12";
-    title: "horus 通知"
+    title: "自定义通知"
     atMobiles:
-      - 15000000
+      - 15000000000
   slack:
     webhookUrl: 
"https://hooks.slack.com/services/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";
+    title: "自定义通知"
 
 nodeDownTime:
   enabled: true
@@ -78,9 +80,12 @@ nodeDownTime:
     cluster: config.1
   dingTalk:
     webhookUrl: 
"https://oapi.dingtalk.com/robot/send?access_token=37f8891e60e524013275cc01efafdb5976b81ef7269ce271b769bcd025826c12";
-    title: "horus 通知"
+    title: "自定义通知"
     atMobiles:
-      - 15000000
+      - 15000000000
+  slack:
+    webhookUrl: 
"https://hooks.slack.com/services/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";
+    title: "自定义通知"
 
 podAbnormal:
   enabled: false
@@ -92,6 +97,9 @@ podAbnormal:
     cluster: config.1
   dingTalk:
     webhookUrl: 
"https://oapi.dingtalk.com/robot/send?access_token=37f8891e60e524013275cc01efafdb5976b81ef7269ce271b769bcd025826c12";
-    title: "horus 通知"
+    title: "自定义通知"
     atMobiles:
-      - 15000000
\ No newline at end of file
+      - 15000000000
+  slack:
+    webhookUrl: 
"https://hooks.slack.com/services/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";
+    title: "自定义通知"
\ No newline at end of file

Reply via email to