AliyunContainerService/kube-eventer

.message的消息,json格式错误

Closed this issue · 1 comments

我尝试使用自定义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的配置

  • --sink=webhook:<webhook_url>&level=Normal&kinds=Pod&reason=Created&header=Content-Type=application/json&custom_body_configmap=custom-webhook-body&custom_body_configmap_namespace=kube-system&method=POST

问题

  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"'}

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