Version: v1.2

Notification

If we want to be notified before or after deploying an application, KubeVela provides integration with notification webhooks, allowing users to send notifications to Email, DingTalk, Slack, Lark.

In this guide, you will learn how to send notifications via notification in workflow.

How to use

Apply the following Application with workflow step type of notification:

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: first-vela-workflow
  5. namespace: default
  6. spec:
  7. components:
  8. - name: express-server
  9. type: webservice
  10. properties:
  11. image: crccheck/hello-world
  12. port: 8000
  13. traits:
  14. - type: ingress
  15. properties:
  16. domain: testsvc.example.com
  17. http:
  18. /: 8000
  19. workflow:
  20. steps:
  21. - name: dingtalk-message
  22. # specify the workflow step type
  23. type: notification
  24. properties:
  25. dingding:
  26. # the DingTalk webhook address, please refer to: https://developers.dingtalk.com/document/robots/custom-robot-access
  27. url:
  28. address: <your dingding url>
  29. # specify the message details
  30. message:
  31. msgtype: text
  32. text:
  33. content: Workflow starting...
  34. - name: application
  35. type: apply-component
  36. properties:
  37. component: express-server
  38. outputs:
  39. - name: app-status
  40. valueFrom: output.status.conditions[0].message + "工作流运行完成"
  41. - name: slack-message
  42. type: notification
  43. inputs:
  44. - from: app-status
  45. parameterKey: slack.message.text
  46. properties:
  47. slack:
  48. # the Slack webhook address, please refer to: https://api.slack.com/messaging/webhooks
  49. url:
  50. fromSecret:
  51. name: <the secret name that stores your slack url>
  52. key: <the secret key that stores your slack url>
  53. # specify the message details, will be filled by the input value
  54. # message:
  55. # text: condition message + Workflow ended.

Expected outcome

we can see that before and after the deployment of the application, the messages can be seen in the corresponding group chat.

With notification, we can integrate with webhook notifier easily.

Parameters

For details, please checkout notification parameters