AliyunContainerService / kube-eventer

kube-eventer emit kubernetes events to sinks
Apache License 2.0
1k stars 275 forks source link

.message的消息,json格式错误 #225

Closed MrLichangming closed 1 year ago

MrLichangming commented 2 years ago

我尝试使用自定义body,发送到webhook,接收到的消息体,message字段json格式错误

configmap文件: apiVersion: v1 data: content: >- {"EventType": "{{ .Type }}","EventKind": "{{ .InvolvedObject.Kind }}","EventReason": "{{ .Reason }}","EventTime": "{{ .LastTimestamp }}","EventMessage": "{{ .Message }}"} kind: ConfigMap metadata: name: custom-webhook-body namespace: kube-system

发送到webhook的配置

问题

  1. 当webhook接收到 BackOff事件或者其他事件, .message消息通常不正常,如下 {"EventType": "Normal","EventKind": "Pod","EventReason": "BackOff","EventTime": "2022-03-08 11:15:47 +0800 CST","EventMessage": 'Back-off pulling image "hub.wusong.com/dev/infrastructure/qiwei:test-5"'}
NUCsimple commented 2 years ago

你是指 EventType 应该为 Warning 还是什么呢?