-
Notifications
You must be signed in to change notification settings - Fork 1
/
bundle.yaml
114 lines (114 loc) · 5.89 KB
/
bundle.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
apiVersion: v1
data:
alertproxy.yaml: "listen: \":9094\"\nproxyTemplates:\n - type: feishu\n template:
|\n {\n {{ if ne .Sign \"\" }}\n \"timestamp\": \"{{ .Timestamp
}}\",\n \"sign\": \"{{ .Sign }}\",\n {{ end }}\n \"msg_type\":
\"interactive\",\n \"card\": {\n \"config\": {\n \"wide_screen_mode\":
true\n },\n \"elements\": [\n {\n \"fields\":
[\n {\n \"is_short\": true,\n \"text\":
{\n \"content\": \"**\U0001F550 开始时间: **{{ .Alert.StartsAt.Format
\"2006-01-02T15:04:05Z07:00\" }}\",\n \"tag\": \"lark_md\"\n
\ }\n },\n {\n \"is_short\":
true,\n \"text\": {\n \"content\": \"**{{
if eq .Alert.Labels.severity \"critical\" }}\U0001F7E3{{ else }}\U0001F534{{ end
}} 级别: **{{ .Alert.Labels.severity }}\",\n \"tag\": \"lark_md\"\n
\ }\n },\n {\n \"is_short\":
true,\n \"text\": {\n \"content\": \"**☸️
集群: **{{ .Alert.Labels.cluster }}\",\n \"tag\": \"lark_md\"\n
\ }\n },\n {\n \"is_short\":
true,\n \"text\": {\n \"content\": \"**\U0001F3E0
命名空间: **{{ .Alert.Labels.gems_namespace }}\",\n \"tag\": \"lark_md\"\n
\ }\n },\n {\n \"is_short\":
true,\n \"text\": {\n \"content\": \"**{{
if eq .Alert.Status \"firing\" }}\U0001F534{{ else }}\U0001F7E2{{ end }} 状态: **{{
.Alert.Status }}\",\n \"tag\": \"lark_md\"\n }\n
\ }{{ $length := len .At }}{{ if gt $length 0 }},\n {\n
\ \"is_short\": true,\n \"text\": {\n \"content\":
\"**\U0001F464 责任人: **{{ range .At }}<at id={{ . }}></at>{{ end }}\",\n \"tag\":
\"lark_md\"\n }\n }\n {{- end -}}\n
\ ],\n \"tag\": \"div\"\n }, \n {\n
\ \"tag\": \"hr\"\n },\n {\n \"tag\":
\"div\",\n \"text\": {\n \"content\": \"{{ .Alert.Annotations.message
}}\",\n \"tag\": \"lark_md\"\n }\n }\n
\ ],\n \"header\": {\n \"template\": \"{{ if eq .Alert.Status
\"firing\" }}red{{ else }}green{{ end }}\",\n \"title\": {\n \"content\":
\"\U0001F525 [KubeGems告警中心] - {{ .Alert.Labels.gems_alertname }}\",\n \"tag\":
\"plain_text\"\n }\n }\n }\n }\n - type: dingding\n
\ template: |\n {\n \"at\": {\n \"atMobiles\":[{{
range $index, $element := .AtMobiles }}{{if $index}},{{end}}\"{{ $element }}\"{{
end }}],\n \"isAtAll\": false\n },\n \"markdown\":
{\n \"title\":\"\U0001F525 [KubeGems告警中心] - {{ .Alert.Labels.gems_alertname
}}\",\n \"text\": \"## \U0001F525 [KubeGems告警中心] - {{ .Alert.Labels.gems_alertname
}} \\n\\n \U0001F550 开始时间: {{ .Alert.StartsAt.Format \"2006-01-02T15:04:05Z07:00\"
}} \\n\\n {{ if eq .Alert.Labels.severity \"critical\" }}\U0001F7E3{{ else }}\U0001F534{{
end }} 级别: {{ .Alert.Labels.severity }} \\n\\n ☸️ 集群: {{ .Alert.Labels.cluster
}} \\n\\n \U0001F3E0 命名空间: {{ .Alert.Labels.gems_namespace }} \\n\\n {{ .Alert.Annotations.message
}} \\n\\n {{ range $index, $element := .AtMobiles }}{{if $index}} {{end}}@{{ $element
}}{{ end }}\"\n },\n \"msgtype\":\"markdown\"\n }\n -
type: aliyunMsg\n template: |\n {\n \"alert\": \"{{ .Alert.Labels.gems_alertname
}}\",\n \"time\": \"{{ .Alert.StartsAt.Format \"2006-01-02 15:04:05\" }}\",\n
\ \"number\": \"1\",\n \"detail\": \"{{ .Alert.Annotations.message
}}\"\n }\n - type: aliyunVoice\n template: |\n {\n \"alert\":
\"{{ .Alert.Labels.gems_alertname }}\",\n \"time\": \"{{ .Alert.StartsAt.Format
\"2006-01-02 15:04:05\" }}\"\n }\n"
kind: ConfigMap
metadata:
name: alertproxy
namespace: kubegems-monitoring
---
apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/name: alertproxy
name: alertproxy
namespace: kubegems-monitoring
spec:
ports:
- name: http
port: 9094
protocol: TCP
targetPort: 9094
selector:
app.kubernetes.io/name: alertproxy
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: alertproxy
namespace: kubegems-monitoring
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: alertproxy
template:
metadata:
labels:
app.kubernetes.io/instance: alertproxy
app.kubernetes.io/name: alertproxy
spec:
containers:
- args:
- serve
- --config
- config/alertproxy.yaml
image: registry.cn-beijing.aliyuncs.com/kubegems/alertproxy:v0.4.2
imagePullPolicy: IfNotPresent
name: alertproxy
ports:
- containerPort: 9094
name: http
protocol: TCP
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /config
name: config
volumes:
- configMap:
defaultMode: 420
name: alertproxy
name: config