Docs: fix built-in workflow steps (#350)

This commit is contained in:
Tianxin Dong 2021-10-20 14:14:08 +08:00 committed by GitHub
parent 1dcd64c1ca
commit dfee49007f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 734 additions and 36 deletions

View File

@ -174,17 +174,23 @@ spec:
### Overview
Send messages to the webhook address.
Send messages to the webhook address, you need to upgrade to KubeVela v1.1.6 or higher to enable `apply-object`.
### Parameters
| Name | Type | Description |
| :--------------: | :----: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| slack | Object | Optional, please fulfill its url and message if you want to send Slack messages |
| slack.url | String | Required, the webhook address of Slack |
| slack.url | Object | Required, the webhook address of Slack, you can choose to fill it in directly or specify it in secret |
| slack.url.address | String | Optional, directly specify the webhook address of Slack |
| slack.url.fromSecret.name | String | Optional, specify the webhook address of Slack from secret |
| slack.url.fromSecret.key | String | Optional, specify the webhook address of Slack from secret, the key of the secret |
| slack.message | Object | Required, the Slack messages you want to send, please follow [Slack messaging](https://api.slack.com/reference/messaging/payload) |
| dingding | Object | Optional, please fulfill its url and message if you want to send DingTalk messages |
| dingding.url | String | Required, the webhook address of DingTalk |
| dingding.url | Object | Required, the webhook address of DingTalk, you can choose to fill it in directly or specify it in secret |
| dingding.url.address | String | Optional, directly specify the webhook address of DingTalk |
| dingding.url.fromSecret.name | String | Optional, specify the webhook address of DingTalk from secret |
| dingding.url.fromSecret.key | String | Optional, specify the webhook address of DingTalk from secret, the key of the secret |
| dingding.message | Object | Required, the DingTalk messages you want to send, please follow [DingTalk messaging](https://developers.dingtalk.com/document/robots/custom-robot-access/title-72m-8ag-pqw) | |
### Example
@ -215,7 +221,8 @@ spec:
properties:
dingding:
# the DingTalk webhook address, please refer to: https://developers.dingtalk.com/document/robots/custom-robot-access
url: xxx
url:
address: <your dingtalk url>
message:
msgtype: text
text:
@ -227,7 +234,10 @@ spec:
properties:
slack:
# the Slack webhook address, please refer to: https://api.slack.com/messaging/webhooks
url: xxx
url:
fromSecret:
name: <the secret name that stores your slack url>
key: <the secret key that stores your slack url>
message:
text: Workflow ended.
```
@ -288,6 +298,158 @@ spec:
component: express-server
```
## read-object
### Overview
Read Kubernetes native resources, you need to upgrade to KubeVela v1.1.6 or higher to enable `read-object`.
### Parameters
| Name | Type | Description |
| :-------: | :----: | :-----------------------------------: |
| apiVersion | String | Required, The apiVersion of the resource you want to read |
| kind | String | Required, The kind of the resource you want to read |
| name | String | Required, The apiVersion of the resource you want to read |
| namespace | String | Optional, The namespace of the resource you want to read, defaults to `default` |
### Example
```yaml
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: read-object
namespace: default
spec:
components:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
port: 8000
workflow:
steps:
- name: read-object
type: read-object
outputs:
- name: cpu
valueFrom: output.value.data["cpu"]
- name: memory
valueFrom: output.value.data["memory"]
properties:
apiVersion: v1
kind: ConfigMap
name: my-cm-name
- name: apply
type: apply-component
inputs:
- from: cpu
parameterKey: cpu
- from: memory
parameterKey: memory
properties:
component: express-server
```
## export2config
### Overview
Export data to ConfigMap, you need to upgrade to KubeVela v1.1.6 or higher to enable `export2config`.
### Parameters
| Name | Type | Description |
| :-------: | :----: | :-----------------------------------: |
| configName | String | Required, The name of the ConfigMap |
| namespace | String | Optional, The namespace of the ConfigMap, defaults to `context.namespace` |
| data | Map | Required, The data that you want to export to ConfigMap |
### Example
```yaml
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: export-config
namespace: default
spec:
components:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
port: 8000
workflow:
steps:
- name: apply-server
type: apply-component
outputs:
- name: status
valueFrom: output.status.conditions[0].message
properties:
component: express-server
- name: export-config
type: export-config
inputs:
- from: status
parameterKey: data.serverstatus
properties:
configName: my-configmap
data:
testkey: testvalue
```
## export2secret
### Overview
Export data to Secret, you need to upgrade to KubeVela v1.1.6 or higher to enable `export2secret`.
### Parameters
| Name | Type | Description |
| :-------: | :----: | :-----------------------------------: |
| secretName | String | Required, The name of the Secret |
| namespace | String | Optional, The namespace of the Secret, defaults to `context.namespace` |
| data | Map | Required, The data that you want to export to Secret |
### Example
```yaml
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: export-secret
namespace: default
spec:
components:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
port: 8000
workflow:
steps:
- name: apply-server
type: apply-component
outputs:
- name: status
valueFrom: output.status.conditions[0].message
properties:
component: express-server
- name: export-secret
type: export-secret
inputs:
- from: status
parameterKey: data.serverstatus
properties:
secretName: my-secret
data:
testkey: testvalue
```
## suspend
### Overview

View File

@ -6,15 +6,23 @@ If we want to be notified before or after deploying an application, KubeVela pro
In this guide, you will learn how to send notifications via `webhook-notification` in workflow.
> Make sure the version of KubeVela is `>=v1.1.6`.
## Parameters
| Parameter | Type | Description |
| :---: | :--: | :-- |
| slack | Object | Optional, please fulfill its url and message if you want to send Slack messages |
| slack.url | String | Required, the webhook address of Slack |
| slack.url | Object | Required, the webhook address of Slack, you can choose to fill it in directly or specify it in secret |
| slack.url.address | String | Optional, directly specify the webhook address of Slack |
| slack.url.fromSecret.name | String | Optional, specify the webhook address of Slack from secret |
| slack.url.fromSecret.key | String | Optional, specify the webhook address of Slack from secret, the key of the secret |
| slack.message | Object | Required, the Slack messages you want to send, please follow [Slack messaging](https://api.slack.com/reference/messaging/payload) |
| dingding | Object | Optional, please fulfill its url and message if you want to send DingTalk messages |
| dingding.url | String | Required, the webhook address of DingTalk |
| dingding.url | Object | Required, the webhook address of DingTalk, you can choose to fill it in directly or specify it in secret |
| dingding.url.address | String | Optional, directly specify the webhook address of DingTalk |
| dingding.url.fromSecret.name | String | Optional, specify the webhook address of DingTalk from secret |
| dingding.url.fromSecret.key | String | Optional, specify the webhook address of DingTalk from secret, the key of the secret |
| dingding.message | Object | Required, the DingTalk messages you want to send, please follow [DingTalk messaging](https://developers.dingtalk.com/document/robots/custom-robot-access/title-72m-8ag-pqw) |
## How to use
@ -48,7 +56,8 @@ spec:
properties:
dingding:
# the DingTalk webhook address, please refer to: https://developers.dingtalk.com/document/robots/custom-robot-access
url: <your dingding url>
url:
address: <your dingding url>
# specify the message details
message:
msgtype: text
@ -69,7 +78,10 @@ spec:
properties:
slack:
# the Slack webhook address, please refer to: https://api.slack.com/messaging/webhooks
url: <your slack url>
url:
fromSecret:
name: <the secret name that stores your slack url>
key: <the secret key that stores your slack url>
# specify the message details, will be filled by the input value
# message:
# text: condition message + Workflow ended.

View File

@ -175,17 +175,23 @@ spec:
### 简介
向指定的 Webhook 发送信息。
向指定的 Webhook 发送信息,该功能在 KubeVela v1.1.6 及以上版本可使用
### 参数
| 参数名 | 类型 | 说明 |
| :--------------: | :----: | :--------------------------------------------------------------------------------------------------------------------------------------- |
| slack | Object | 可选值,如果需要发送 Slack 信息,则需填写其 url 及 message |
| slack.url | String | 必填值Slack 的 Webhook 地址 |
| slack.url | Object | 必填值Slack 的 Webhook 地址,可以选择直接填写或从 secret 中获取 |
| slack.url.address | String | 可选值,直接填写 Slack 的 Webhook 地址 |
| slack.url.fromSecret.name | String | 可选值, 从 secret 中获取 Webhook 地址secret 的名字 |
| slack.url.fromSecret.key | String | 可选值, 从 secret 中获取 Webhook 地址,从 secret 中获取的 key |
| slack.message | Object | 必填值,需要发送的 Slack 信息,请符合 [Slack 信息规范](https://api.slack.com/reference/messaging/payload) |
| dingding | Object | 可选值,如果需要发送钉钉信息,则需填写其 url 及 message |
| dingding.url | String | 必填值,钉钉的 Webhook 地址 |
| dingding.url | Object | 必填值,钉钉的 Webhook 地址,可以选择直接填写或从 secret 中获取 |
| dingding.url.address | String | 可选值,直接填写钉钉的 Webhook 地址 |
| dingding.url.fromSecret.name | String | 可选值, 从 secret 中获取 Webhook 地址secret 的名字 |
| dingding.url.fromSecret.key | String | 可选值, 从 secret 中获取 Webhook 地址,从 secret 中获取的 key |
| dingding.message | Object | 必填值,需要发送的钉钉信息,请符合 [钉钉信息规范](https://developers.dingtalk.com/document/robots/custom-robot-access/title-72m-8ag-pqw) |
### 示例
@ -216,7 +222,8 @@ spec:
properties:
dingding:
# 钉钉 Webhook 地址请查看https://developers.dingtalk.com/document/robots/custom-robot-access
url: xxx
url:
address: <your dingtalk url>
message:
msgtype: text
text:
@ -228,7 +235,10 @@ spec:
properties:
slack:
# Slack Webhook 地址请查看https://api.slack.com/messaging/webhooks
url: xxx
url:
fromSecret:
name: <the secret name that stores your slack url>
key: <the secret key that stores your slack url>
message:
text: 工作流运行完成
```
@ -289,6 +299,159 @@ spec:
component: express-server
```
## read-object
### 简介
读取 Kubernetes 原生资源,该功能在 KubeVela v1.1.6 及以上版本可使用。
### 参数
| 参数名 | 类型 | 说明 |
| :-------: | :----: | :-----------------------------------: |
| apiVersion | String | 必填值,资源的 apiVersion |
| kind | String | 必填值,资源的 kind |
| name | String | 必填值,资源的 name |
| namespace | String | 选填值,资源的 namespace默认为 `default` |
### 示例
```yaml
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: read-object
namespace: default
spec:
components:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
port: 8000
workflow:
steps:
- name: read-object
type: read-object
outputs:
- name: cpu
valueFrom: output.value.data["cpu"]
- name: memory
valueFrom: output.value.data["memory"]
properties:
apiVersion: v1
kind: ConfigMap
name: my-cm-name
- name: apply
type: apply-component
inputs:
- from: cpu
parameterKey: cpu
- from: memory
parameterKey: memory
properties:
component: express-server
```
## export2config
### 简介
导出数据到 ConfigMap该功能在 KubeVela v1.1.6 及以上版本可使用。
### 参数
| 参数名 | 类型 | 说明 |
| :-------: | :----: | :-----------------------------------: |
| configName | String | 必填值ConfigMap 的名称 |
| namespace | String | 选填值ConfigMap 的 namespace默认为 `context.namespace` |
| data | Map | 必填值,需要导出到 ConfigMap 中的数据 |
### 示例
```yaml
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: export-config
namespace: default
spec:
components:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
port: 8000
workflow:
steps:
- name: apply-server
type: apply-component
outputs:
- name: status
valueFrom: output.status.conditions[0].message
properties:
component: express-server
- name: export-config
type: export-config
inputs:
- from: status
parameterKey: data.serverstatus
properties:
configName: my-configmap
data:
testkey: testvalue
```
## export2secret
### 简介
导出数据到 Secret该功能在 KubeVela v1.1.6 及以上版本可使用。
### 参数
| 参数名 | 类型 | 说明 |
| :-------: | :----: | :-----------------------------------: |
| secretName | String | 必填值Secret 的名称 |
| namespace | String | 选填值Secret 的 namespace默认为 `context.namespace` |
| data | Map | 必填值,需要导出到 Secret 中的数据 |
### 示例
```yaml
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: export-secret
namespace: default
spec:
components:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
port: 8000
workflow:
steps:
- name: apply-server
type: apply-component
outputs:
- name: status
valueFrom: output.status.conditions[0].message
properties:
component: express-server
- name: export-secret
type: export-secret
inputs:
- from: status
parameterKey: data.serverstatus
properties:
secretName: my-secret
data:
testkey: testvalue
```
## suspend
### 简介

View File

@ -6,15 +6,23 @@ title: 使用 Webhook 发送通知
本节将介绍如何在工作流中通过 `webhook-notification` 发送 Webhook 通知。
> 请确保你的 KubeVela 版本 `>=v1.1.6`
## 参数说明
| 参数 | 类型 | 说明 |
| :---: | :--: | :-- |
| slack | Object | 可选值,如果需要发送 Slack 信息,则需填写其 url 及 message |
| slack.url | String | 必填值Slack 的 Webhook 地址 |
| slack.url | Object | 必填值Slack 的 Webhook 地址,可以选择直接填写或从 secret 中获取 |
| slack.url.address | String | 可选值,直接填写 Slack 的 Webhook 地址 |
| slack.url.fromSecret.name | String | 可选值, 从 secret 中获取 Webhook 地址secret 的名字 |
| slack.url.fromSecret.key | String | 可选值, 从 secret 中获取 Webhook 地址,从 secret 中获取的 key |
| slack.message | Object | 必填值,需要发送的 Slack 信息,请符合 [Slack 信息规范](https://api.slack.com/reference/messaging/payload) |
| dingding | Object | 可选值,如果需要发送钉钉信息,则需填写其 url 及 message |
| dingding.url | String | 必填值,钉钉的 Webhook 地址 |
| dingding.url | Object | 必填值,钉钉的 Webhook 地址,可以选择直接填写或从 secret 中获取 |
| dingding.url.address | String | 可选值,直接填写钉钉的 Webhook 地址 |
| dingding.url.fromSecret.name | String | 可选值, 从 secret 中获取 Webhook 地址secret 的名字 |
| dingding.url.fromSecret.key | String | 可选值, 从 secret 中获取 Webhook 地址,从 secret 中获取的 key |
| dingding.message | Object | 必填值,需要发送的钉钉信息,请符合 [钉钉信息规范](https://developers.dingtalk.com/document/robots/custom-robot-access/title-72m-8ag-pqw) |
## 如何使用
@ -48,7 +56,8 @@ spec:
properties:
dingding:
# 钉钉 Webhook 地址请查看https://developers.dingtalk.com/document/robots/custom-robot-access
url: <your dingding url>
url:
address: <your dingding url>
# 具体要发送的信息详情
message:
msgtype: text
@ -69,7 +78,10 @@ spec:
properties:
slack:
# Slack Webhook 地址请查看https://api.slack.com/messaging/webhooks
url: <your slack url>
url:
fromSecret:
name: <the secret name that stores your slack url>
key: <the secret key that stores your slack url>
# 具体要发送的信息详情,会被 input 中的值覆盖
# message:
# text: condition message + 工作流运行完成

View File

@ -175,17 +175,23 @@ spec:
### 简介
向指定的 Webhook 发送信息。
向指定的 Webhook 发送信息,该功能在 KubeVela v1.1.6 及以上版本可使用
### 参数
| 参数名 | 类型 | 说明 |
| :--------------: | :----: | :--------------------------------------------------------------------------------------------------------------------------------------- |
| slack | Object | 可选值,如果需要发送 Slack 信息,则需填写其 url 及 message |
| slack.url | String | 必填值Slack 的 Webhook 地址 |
| slack.url | Object | 必填值Slack 的 Webhook 地址,可以选择直接填写或从 secret 中获取 |
| slack.url.address | String | 可选值,直接填写 Slack 的 Webhook 地址 |
| slack.url.fromSecret.name | String | 可选值, 从 secret 中获取 Webhook 地址secret 的名字 |
| slack.url.fromSecret.key | String | 可选值, 从 secret 中获取 Webhook 地址,从 secret 中获取的 key |
| slack.message | Object | 必填值,需要发送的 Slack 信息,请符合 [Slack 信息规范](https://api.slack.com/reference/messaging/payload) |
| dingding | Object | 可选值,如果需要发送钉钉信息,则需填写其 url 及 message |
| dingding.url | String | 必填值,钉钉的 Webhook 地址 |
| dingding.url | Object | 必填值,钉钉的 Webhook 地址,可以选择直接填写或从 secret 中获取 |
| dingding.url.address | String | 可选值,直接填写钉钉的 Webhook 地址 |
| dingding.url.fromSecret.name | String | 可选值, 从 secret 中获取 Webhook 地址secret 的名字 |
| dingding.url.fromSecret.key | String | 可选值, 从 secret 中获取 Webhook 地址,从 secret 中获取的 key |
| dingding.message | Object | 必填值,需要发送的钉钉信息,请符合 [钉钉信息规范](https://developers.dingtalk.com/document/robots/custom-robot-access/title-72m-8ag-pqw) |
### 示例
@ -216,7 +222,8 @@ spec:
properties:
dingding:
# 钉钉 Webhook 地址请查看https://developers.dingtalk.com/document/robots/custom-robot-access
url: xxx
url:
address: <your dingtalk url>
message:
msgtype: text
text:
@ -228,7 +235,10 @@ spec:
properties:
slack:
# Slack Webhook 地址请查看https://api.slack.com/messaging/webhooks
url: xxx
url:
fromSecret:
name: <the secret name that stores your slack url>
key: <the secret key that stores your slack url>
message:
text: 工作流运行完成
```
@ -289,6 +299,159 @@ spec:
component: express-server
```
## read-object
### 简介
读取 Kubernetes 原生资源,该功能在 KubeVela v1.1.6 及以上版本可使用。
### 参数
| 参数名 | 类型 | 说明 |
| :-------: | :----: | :-----------------------------------: |
| apiVersion | String | 必填值,资源的 apiVersion |
| kind | String | 必填值,资源的 kind |
| name | String | 必填值,资源的 name |
| namespace | String | 选填值,资源的 namespace默认为 `default` |
### 示例
```yaml
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: read-object
namespace: default
spec:
components:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
port: 8000
workflow:
steps:
- name: read-object
type: read-object
outputs:
- name: cpu
valueFrom: output.value.data["cpu"]
- name: memory
valueFrom: output.value.data["memory"]
properties:
apiVersion: v1
kind: ConfigMap
name: my-cm-name
- name: apply
type: apply-component
inputs:
- from: cpu
parameterKey: cpu
- from: memory
parameterKey: memory
properties:
component: express-server
```
## export2config
### 简介
导出数据到 ConfigMap该功能在 KubeVela v1.1.6 及以上版本可使用。
### 参数
| 参数名 | 类型 | 说明 |
| :-------: | :----: | :-----------------------------------: |
| configName | String | 必填值ConfigMap 的名称 |
| namespace | String | 选填值ConfigMap 的 namespace默认为 `context.namespace` |
| data | Map | 必填值,需要导出到 ConfigMap 中的数据 |
### 示例
```yaml
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: export-config
namespace: default
spec:
components:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
port: 8000
workflow:
steps:
- name: apply-server
type: apply-component
outputs:
- name: status
valueFrom: output.status.conditions[0].message
properties:
component: express-server
- name: export-config
type: export-config
inputs:
- from: status
parameterKey: data.serverstatus
properties:
configName: my-configmap
data:
testkey: testvalue
```
## export2secret
### 简介
导出数据到 Secret该功能在 KubeVela v1.1.6 及以上版本可使用。
### 参数
| 参数名 | 类型 | 说明 |
| :-------: | :----: | :-----------------------------------: |
| secretName | String | 必填值Secret 的名称 |
| namespace | String | 选填值Secret 的 namespace默认为 `context.namespace` |
| data | Map | 必填值,需要导出到 Secret 中的数据 |
### 示例
```yaml
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: export-secret
namespace: default
spec:
components:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
port: 8000
workflow:
steps:
- name: apply-server
type: apply-component
outputs:
- name: status
valueFrom: output.status.conditions[0].message
properties:
component: express-server
- name: export-secret
type: export-secret
inputs:
- from: status
parameterKey: data.serverstatus
properties:
secretName: my-secret
data:
testkey: testvalue
```
## suspend
### 简介

View File

@ -6,15 +6,23 @@ title: 使用 Webhook 发送通知
本节将介绍如何在工作流中通过 `webhook-notification` 发送 Webhook 通知。
> 请确保你的 KubeVela 版本 `>=v1.1.6`
## 参数说明
| 参数 | 类型 | 说明 |
| :---: | :--: | :-- |
| slack | Object | 可选值,如果需要发送 Slack 信息,则需填写其 url 及 message |
| slack.url | String | 必填值Slack 的 Webhook 地址 |
| slack.url | Object | 必填值Slack 的 Webhook 地址,可以选择直接填写或从 secret 中获取 |
| slack.url.address | String | 可选值,直接填写 Slack 的 Webhook 地址 |
| slack.url.fromSecret.name | String | 可选值, 从 secret 中获取 Webhook 地址secret 的名字 |
| slack.url.fromSecret.key | String | 可选值, 从 secret 中获取 Webhook 地址,从 secret 中获取的 key |
| slack.message | Object | 必填值,需要发送的 Slack 信息,请符合 [Slack 信息规范](https://api.slack.com/reference/messaging/payload) |
| dingding | Object | 可选值,如果需要发送钉钉信息,则需填写其 url 及 message |
| dingding.url | String | 必填值,钉钉的 Webhook 地址 |
| dingding.url | Object | 必填值,钉钉的 Webhook 地址,可以选择直接填写或从 secret 中获取 |
| dingding.url.address | String | 可选值,直接填写钉钉的 Webhook 地址 |
| dingding.url.fromSecret.name | String | 可选值, 从 secret 中获取 Webhook 地址secret 的名字 |
| dingding.url.fromSecret.key | String | 可选值, 从 secret 中获取 Webhook 地址,从 secret 中获取的 key |
| dingding.message | Object | 必填值,需要发送的钉钉信息,请符合 [钉钉信息规范](https://developers.dingtalk.com/document/robots/custom-robot-access/title-72m-8ag-pqw) |
## 如何使用
@ -48,7 +56,8 @@ spec:
properties:
dingding:
# 钉钉 Webhook 地址请查看https://developers.dingtalk.com/document/robots/custom-robot-access
url: <your dingding url>
url:
address: <your dingding url>
# 具体要发送的信息详情
message:
msgtype: text
@ -69,7 +78,10 @@ spec:
properties:
slack:
# Slack Webhook 地址请查看https://api.slack.com/messaging/webhooks
url: <your slack url>
url:
fromSecret:
name: <the secret name that stores your slack url>
key: <the secret key that stores your slack url>
# 具体要发送的信息详情,会被 input 中的值覆盖
# message:
# text: condition message + 工作流运行完成

View File

@ -174,17 +174,23 @@ spec:
### Overview
Send messages to the webhook address.
Send messages to the webhook address, you need to upgrade to KubeVela v1.1.6 or higher to enable `apply-object`.
### Parameters
| Name | Type | Description |
| :--------------: | :----: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| slack | Object | Optional, please fulfill its url and message if you want to send Slack messages |
| slack.url | String | Required, the webhook address of Slack |
| slack.url | Object | Required, the webhook address of Slack, you can choose to fill it in directly or specify it in secret |
| slack.url.address | String | Optional, directly specify the webhook address of Slack |
| slack.url.fromSecret.name | String | Optional, specify the webhook address of Slack from secret |
| slack.url.fromSecret.key | String | Optional, specify the webhook address of Slack from secret, the key of the secret |
| slack.message | Object | Required, the Slack messages you want to send, please follow [Slack messaging](https://api.slack.com/reference/messaging/payload) |
| dingding | Object | Optional, please fulfill its url and message if you want to send DingTalk messages |
| dingding.url | String | Required, the webhook address of DingTalk |
| dingding.url | Object | Required, the webhook address of DingTalk, you can choose to fill it in directly or specify it in secret |
| dingding.url.address | String | Optional, directly specify the webhook address of DingTalk |
| dingding.url.fromSecret.name | String | Optional, specify the webhook address of DingTalk from secret |
| dingding.url.fromSecret.key | String | Optional, specify the webhook address of DingTalk from secret, the key of the secret |
| dingding.message | Object | Required, the DingTalk messages you want to send, please follow [DingTalk messaging](https://developers.dingtalk.com/document/robots/custom-robot-access/title-72m-8ag-pqw) | |
### Example
@ -215,7 +221,8 @@ spec:
properties:
dingding:
# the DingTalk webhook address, please refer to: https://developers.dingtalk.com/document/robots/custom-robot-access
url: xxx
url:
address: <your dingtalk url>
message:
msgtype: text
text:
@ -227,7 +234,10 @@ spec:
properties:
slack:
# the Slack webhook address, please refer to: https://api.slack.com/messaging/webhooks
url: xxx
url:
fromSecret:
name: <the secret name that stores your slack url>
key: <the secret key that stores your slack url>
message:
text: Workflow ended.
```
@ -288,6 +298,158 @@ spec:
component: express-server
```
## read-object
### Overview
Read Kubernetes native resources, you need to upgrade to KubeVela v1.1.6 or higher to enable `read-object`.
### Parameters
| Name | Type | Description |
| :-------: | :----: | :-----------------------------------: |
| apiVersion | String | Required, The apiVersion of the resource you want to read |
| kind | String | Required, The kind of the resource you want to read |
| name | String | Required, The apiVersion of the resource you want to read |
| namespace | String | Optional, The namespace of the resource you want to read, defaults to `default` |
### Example
```yaml
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: read-object
namespace: default
spec:
components:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
port: 8000
workflow:
steps:
- name: read-object
type: read-object
outputs:
- name: cpu
valueFrom: output.value.data["cpu"]
- name: memory
valueFrom: output.value.data["memory"]
properties:
apiVersion: v1
kind: ConfigMap
name: my-cm-name
- name: apply
type: apply-component
inputs:
- from: cpu
parameterKey: cpu
- from: memory
parameterKey: memory
properties:
component: express-server
```
## export2config
### Overview
Export data to ConfigMap, you need to upgrade to KubeVela v1.1.6 or higher to enable `export2config`.
### Parameters
| Name | Type | Description |
| :-------: | :----: | :-----------------------------------: |
| configName | String | Required, The name of the ConfigMap |
| namespace | String | Optional, The namespace of the ConfigMap, defaults to `context.namespace` |
| data | Map | Required, The data that you want to export to ConfigMap |
### Example
```yaml
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: export-config
namespace: default
spec:
components:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
port: 8000
workflow:
steps:
- name: apply-server
type: apply-component
outputs:
- name: status
valueFrom: output.status.conditions[0].message
properties:
component: express-server
- name: export-config
type: export-config
inputs:
- from: status
parameterKey: data.serverstatus
properties:
configName: my-configmap
data:
testkey: testvalue
```
## export2secret
### Overview
Export data to Secret, you need to upgrade to KubeVela v1.1.6 or higher to enable `export2secret`.
### Parameters
| Name | Type | Description |
| :-------: | :----: | :-----------------------------------: |
| secretName | String | Required, The name of the Secret |
| namespace | String | Optional, The namespace of the Secret, defaults to `context.namespace` |
| data | Map | Required, The data that you want to export to Secret |
### Example
```yaml
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: export-secret
namespace: default
spec:
components:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
port: 8000
workflow:
steps:
- name: apply-server
type: apply-component
outputs:
- name: status
valueFrom: output.status.conditions[0].message
properties:
component: express-server
- name: export-secret
type: export-secret
inputs:
- from: status
parameterKey: data.serverstatus
properties:
secretName: my-secret
data:
testkey: testvalue
```
## suspend
### Overview

View File

@ -6,15 +6,23 @@ If we want to be notified before or after deploying an application, KubeVela pro
In this guide, you will learn how to send notifications via `webhook-notification` in workflow.
> Make sure the version of KubeVela is `>=v1.1.6`.
## Parameters
| Parameter | Type | Description |
| :---: | :--: | :-- |
| slack | Object | Optional, please fulfill its url and message if you want to send Slack messages |
| slack.url | String | Required, the webhook address of Slack |
| slack.url | Object | Required, the webhook address of Slack, you can choose to fill it in directly or specify it in secret |
| slack.url.address | String | Optional, directly specify the webhook address of Slack |
| slack.url.fromSecret.name | String | Optional, specify the webhook address of Slack from secret |
| slack.url.fromSecret.key | String | Optional, specify the webhook address of Slack from secret, the key of the secret |
| slack.message | Object | Required, the Slack messages you want to send, please follow [Slack messaging](https://api.slack.com/reference/messaging/payload) |
| dingding | Object | Optional, please fulfill its url and message if you want to send DingTalk messages |
| dingding.url | String | Required, the webhook address of DingTalk |
| dingding.url | Object | Required, the webhook address of DingTalk, you can choose to fill it in directly or specify it in secret |
| dingding.url.address | String | Optional, directly specify the webhook address of DingTalk |
| dingding.url.fromSecret.name | String | Optional, specify the webhook address of DingTalk from secret |
| dingding.url.fromSecret.key | String | Optional, specify the webhook address of DingTalk from secret, the key of the secret |
| dingding.message | Object | Required, the DingTalk messages you want to send, please follow [DingTalk messaging](https://developers.dingtalk.com/document/robots/custom-robot-access/title-72m-8ag-pqw) |
## How to use
@ -48,7 +56,8 @@ spec:
properties:
dingding:
# the DingTalk webhook address, please refer to: https://developers.dingtalk.com/document/robots/custom-robot-access
url: <your dingding url>
url:
address: <your dingding url>
# specify the message details
message:
msgtype: text
@ -69,7 +78,10 @@ spec:
properties:
slack:
# the Slack webhook address, please refer to: https://api.slack.com/messaging/webhooks
url: <your slack url>
url:
fromSecret:
name: <the secret name that stores your slack url>
key: <the secret key that stores your slack url>
# specify the message details, will be filled by the input value
# message:
# text: condition message + Workflow ended.