Skip to main content
版本:v1.9

内置工作流步骤列表

本文档将按字典序展示所有内置工作流步骤的参数列表。

本文档由脚本自动生成,请勿手动修改,上次更新于 2023-07-28T09:33:26+08:00。

Addon-Operation

描述

Enable a KubeVela addon。

适用范围

该步骤类型只适用于 WorkflowRun。

示例 (addon-operation)

apiVersion: core.oam.dev/v1alpha1
kind: WorkflowRun
metadata:
name: observability
namespace: vela-system
spec:
context:
readConfig: true
mode:
workflowSpec:
steps:
- name: Enable Prism
type: addon-operation
properties:
addonName: vela-prism

- name: Enable o11y
type: addon-operation
properties:
addonName: o11y-definitions
operation: enable
args:
- --override-definitions

- name: Prepare Prometheus
type: step-group
subSteps:
- name: get-exist-prometheus
type: list-config
properties:
template: prometheus-server
outputs:
- name: prometheus
valueFrom: "output.configs"

- name: prometheus-server
inputs:
- from: prometheus
# TODO: Make it is not required
parameterKey: configs
if: "!context.readConfig || len(inputs.prometheus) == 0"
type: addon-operation
properties:
addonName: prometheus-server
operation: enable
args:
- memory=4096Mi
- serviceType=LoadBalancer

- name: Prepare Loki
type: addon-operation
properties:
addonName: loki
operation: enable
args:
- --version=v0.1.4
- agent=vector
- serviceType=LoadBalancer

- name: Prepare Grafana
type: step-group
subSteps:

- name: get-exist-grafana
type: list-config
properties:
template: grafana
outputs:
- name: grafana
valueFrom: "output.configs"

- name: Install Grafana & Init Dashboards
inputs:
- from: grafana
parameterKey: configs
if: "!context.readConfig || len(inputs.grafana) == 0"
type: addon-operation
properties:
addonName: grafana
operation: enable
args:
- serviceType=LoadBalancer

- name: Init Dashboards
inputs:
- from: grafana
parameterKey: configs
if: "len(inputs.grafana) != 0"
type: addon-operation
properties:
addonName: grafana
operation: enable
args:
- install=false

- name: Clean
type: clean-jobs

- name: print-message
type: print-message-in-status
properties:
message: "All addons have been enabled successfully, you can use 'vela addon list' to check them."

参数说明 (addon-operation)

名称描述类型是否必须默认值
addonNameSpecify the name of the addon。stringtrue
argsSpecify addon enable args。[]stringfalse
imageSpecify the image。stringfalseoamdev/vela-cli:v1.7.2
operationoperation for the addon。"enable" or "upgrade" or "disable"falseenable
serviceAccountNamespecify serviceAccountName want to use。stringfalsekubevela-vela-core

Apply-App

描述

Apply application from data or ref to the cluster。

适用范围

该步骤类型只适用于 WorkflowRun。

示例 (apply-app)

apiVersion: core.oam.dev/v1alpha1
kind: WorkflowRun
metadata:
name: apply-applications
namespace: default
annotations:
workflowrun.oam.dev/debug: "true"
spec:
workflowSpec:
steps:
- name: check-app-exist
type: read-app
properties:
name: webservice-app
- name: apply-app1
type: apply-app
if: status["check-app-exist"].message == "Application not found"
properties:
data:
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: webservice-app
spec:
components:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
ports:
- port: 8000
- name: suspend
type: suspend
timeout: 24h
- name: apply-app2
type: apply-app
properties:
ref:
name: my-app
key: application
type: configMap
---
apiVersion: v1
kind: ConfigMap
metadata:
name: my-app
namespace: default
data:
application: |
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: webservice-app2
spec:
components:
- name: express-server2
type: webservice
properties:
image: crccheck/hello-world
ports:
- port: 8000

参数说明 (apply-app)

名称描述类型是否必须默认值
datamap[string]_false
refreffalse

ref (apply-app)

名称描述类型是否必须默认值
namestringtrue
namespace|true
typestringfalseconfigMap
keystringfalseapplication

Apply-Component

描述

Apply a specific component and its corresponding traits in application。

适用范围

该步骤类型只适用于 Application。

示例 (apply-component)

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: first-vela-workflow
namespace: default
spec:
components:
- name: express-server
type: webservice
properties:
image: oamdev/hello-world
port: 8000
traits:
- type: ingress
properties:
domain: testsvc.example.com
http:
/: 8000
workflow:
steps:
- name: express-server
type: apply-component
properties:
component: express-server
# cluster: <your cluster name>
# namespace: <your namespace name>

参数说明 (apply-component)

名称描述类型是否必须默认值
componentSpecify the component name to apply。stringtrue
clusterSpecify the cluster。stringfalseempty
namespaceSpecify the namespace。stringfalseempty

Apply-Deployment

描述

Apply deployment with specified image and cmd。

适用范围

该步骤类型适用于 Application 和 WorkflowRun。

示例 (apply-deployment)

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: apply-deploy
namespace: default
spec:
components:
- name: express-server
type: webservice
properties:
image: oamdev/hello-world
port: 8000
workflow:
steps:
- name: apply-comp
type: apply-component
properties:
component: express-server
- name: apply-deploy
type: apply-deployment
properties:
image: nginx

参数说明 (apply-deployment)

名称描述类型是否必须默认值
imagestringtrue
replicasintfalse1
clusterstringfalseempty
cmd[]stringfalse

Apply-Object

描述

在工作流中部署 Kubernetes 资源对象。

适用范围

该步骤类型适用于 Application 和 WorkflowRun。

示例 (apply-object)

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: server-with-pvc
namespace: default
spec:
components:
- name: express-server
type: webservice
properties:
image: oamdev/hello-world
port: 8000
volumes:
- name: "my-pvc"
type: "pvc"
mountPath: "/test"
claimName: "myclaim"

workflow:
steps:
- name: apply-pvc
type: apply-object
properties:
# Kubernetes native resources fields
value:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: myclaim
namespace: default
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 8Gi
storageClassName: standard
# the cluster you want to apply the resource to, default is the current cluster
cluster: <your cluster name>
- name: apply-server
type: apply-component
properties:
component: express-serve

参数说明 (apply-object)

名称描述类型是否必须默认值
valueKubernetes 资源对象参数。map[string]_true
cluster需要部署的集群名称。如果不指定,则为当前集群。stringfalseempty

Apply-Terraform-Config

描述

Apply terraform configuration in the step。

适用范围

该步骤类型适用于 Application 和 WorkflowRun。

示例 (apply-terraform-config)

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: apply-terraform-resource
namespace: default
spec:
components: []
workflow:
steps:
- name: provider
type: apply-terraform-provider
properties:
type: alibaba
name: my-alibaba-provider
accessKey: <accessKey>
secretKey: <secretKey>
region: cn-hangzhou
- name: configuration
type: apply-terraform-config
properties:
source:
path: alibaba/cs/dedicated-kubernetes
remote: https://github.com/FogDong/terraform-modules
providerRef:
name: my-alibaba-provider
writeConnectionSecretToRef:
name: my-terraform-secret
namespace: vela-system
variable:
name: regular-check-ack
new_nat_gateway: true
vpc_name: "tf-k8s-vpc-regular-check"
vpc_cidr: "10.0.0.0/8"
vswitch_name_prefix: "tf-k8s-vsw-regualr-check"
vswitch_cidrs: [ "10.1.0.0/16", "10.2.0.0/16", "10.3.0.0/16" ]
k8s_name_prefix: "tf-k8s-regular-check"
k8s_version: 1.24.6-aliyun.1
k8s_pod_cidr: "192.168.5.0/24"
k8s_service_cidr: "192.168.2.0/24"
k8s_worker_number: 2
cpu_core_count: 4
memory_size: 8
tags:
created_by: "Terraform-of-KubeVela"
created_from: "module-tf-alicloud-ecs-instance"

参数说明 (apply-terraform-config)

名称描述类型是否必须默认值
sourcespecify the source of the terraform configuration。type-option-1 or type-option-2true
deleteResourcewhether to delete resource。boolfalsetrue
variablethe variable in the configuration。map[string]_true
writeConnectionSecretToRefthis specifies the namespace and name of a secret to which any connection details for this managed resource should be written。writeConnectionSecretToReffalse
providerRefproviderRef specifies the reference to Provider。providerReffalse
regionregion is cloud provider's region. It will override the region in the region field of providerRef。stringfalse
jobEnvthe envs for job。map[string]_false
forceDeleteforceDelete will force delete Configuration no matter which state it is or whether it has provisioned some resources。boolfalsefalse

type-option-1 (apply-terraform-config)

名称描述类型是否必须默认值
hcldirectly specify the hcl of the terraform configuration。stringtrue

type-option-2 (apply-terraform-config)

名称描述类型是否必须默认值
remotespecify the remote url of the terraform configuration。stringfalsehttps://github.com/kubevela-contrib/terraform-modules.git
pathspecify the path of the terraform configuration。stringfalse

writeConnectionSecretToRef (apply-terraform-config)

名称描述类型是否必须默认值
namestringtrue
namespace|true

providerRef (apply-terraform-config)

名称描述类型是否必须默认值
namestringtrue
namespace|true

Apply-Terraform-Provider

描述

Apply terraform provider config。

适用范围

该步骤类型适用于 Application 和 WorkflowRun。

示例 (apply-terraform-provider)

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: apply-terraform-provider
namespace: default
spec:
components: []
workflow:
steps:
- name: provider
type: apply-terraform-provider
properties:
type: alibaba
name: my-alibaba-provider
accessKey: <accessKey>
secretKey: <secretKey>
region: cn-hangzhou

参数说明 (apply-terraform-provider)

名称描述类型是否必须默认值
AlibabaProvider or AWSProvider or AzureProvider or BaiduProvider or ECProvider or GCPProvider or TencentProvider or UCloudProviderfalse

AlibabaProvider (apply-terraform-provider)

名称描述类型是否必须默认值
typestringtrue
accessKeystringtrue
secretKeystringtrue
namestringfalsealibaba-provider
regionstringtrue

AWSProvider (apply-terraform-provider)

名称描述类型是否必须默认值
tokenstringfalseempty
typestringtrue
accessKeystringtrue
secretKeystringtrue
namestringfalseaws-provider
regionstringtrue

AzureProvider (apply-terraform-provider)

名称描述类型是否必须默认值
subscriptionIDstringtrue
tenantIDstringtrue
clientIDstringtrue
clientSecretstringtrue
namestringfalseazure-provider

BaiduProvider (apply-terraform-provider)

名称描述类型是否必须默认值
typestringtrue
accessKeystringtrue
secretKeystringtrue
namestringfalsebaidu-provider
regionstringtrue

ECProvider (apply-terraform-provider)

名称描述类型是否必须默认值
typestringtrue
apiKeystringfalseempty
namestringfalseec-provider

GCPProvider (apply-terraform-provider)

名称描述类型是否必须默认值
credentialsstringtrue
regionstringtrue
projectstringtrue
typestringtrue
namestringfalsegcp-provider

TencentProvider (apply-terraform-provider)

名称描述类型是否必须默认值
secretIDstringtrue
secretKeystringtrue
regionstringtrue
typestringtrue
namestringfalsetencent-provider

UCloudProvider (apply-terraform-provider)

名称描述类型是否必须默认值
publicKeystringtrue
privateKeystringtrue
projectIDstringtrue
regionstringtrue
typestringtrue
namestringfalseucloud-provider

Build-Push-Image

描述

Build and push image from git url。

适用范围

该步骤类型适用于 Application 和 WorkflowRun。

示例 (build-push-image)

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: build-push-image
namespace: default
spec:
components:
- name: my-web
type: webservice
properties:
image: fogdong/simple-web-demo:v1
ports:
- port: 80
expose: true
workflow:
steps:
- name: create-git-secret
type: export2secret
properties:
secretName: git-secret
data:
token: <git token>
- name: create-image-secret
type: export2secret
properties:
secretName: image-secret
kind: docker-registry
dockerRegistry:
username: <docker username>
password: <docker password>
- name: build-push
type: build-push-image
properties:
# use your kaniko executor image like below, if not set, it will use default image oamdev/kaniko-executor:v1.9.1
# kanikoExecutor: gcr.io/kaniko-project/executor:latest
# you can use context with git and branch or directly specify the context, please refer to https://github.com/GoogleContainerTools/kaniko#kaniko-build-contexts
context:
git: github.com/FogDong/simple-web-demo
branch: main
image: fogdong/simple-web-demo:v1
# specify your dockerfile, if not set, it will use default dockerfile ./Dockerfile
# dockerfile: ./Dockerfile
credentials:
image:
name: image-secret
# buildArgs:
# - key="value"
# platform: linux/arm
- name: apply-comp
type: apply-component
properties:
component: my-web

参数说明 (build-push-image)

名称描述类型是否必须默认值
kanikoExecutorSpecify the kaniko executor image, default to oamdev/kaniko-executor:v1.9.1。stringfalseoamdev/kaniko-executor:v1.9.1
contextSpecify the context to build image, you can use context with git and branch or directly specify the context, please refer to https://github.com/GoogleContainerTools/kaniko#kaniko-build-contexts。stringtrue
dockerfileSpecify the dockerfile。stringfalse./Dockerfile
imageSpecify the image。stringtrue
platformSpecify the platform to build。stringfalse
buildArgsSpecify the build args。[]stringfalse
credentialsSpecify the credentials to access git and image registry。credentialsfalse
verbositySpecify the verbosity level。"info" or "panic" or "fatal" or "error" or "warn" or "debug" or "trace"falseinfo

credentials (build-push-image)

名称描述类型是否必须默认值
gitSpecify the credentials to access git。gitfalse
imageSpecify the credentials to access image registry。imagefalse
git (build-push-image)
名称描述类型是否必须默认值
nameSpecify the secret name。stringtrue
keySpecify the secret key。stringtrue
image (build-push-image)
名称描述类型是否必须默认值
nameSpecify the secret name。stringtrue
keySpecify the secret key。stringfalse.dockerconfigjson

Chat-Gpt

描述

Send request to chat-gpt。

适用范围

该步骤类型适用于 Application 和 WorkflowRun。

示例 (chat-gpt)

apiVersion: core.oam.dev/v1alpha1
kind: WorkflowRun
metadata:
name: chat-gpt
namespace: default
spec:
workflowSpec:
steps:
# apply a deployment with invalid image, this step will fail because of timeout
# the resource will be passed to chat-gpt step to anaylze
- name: apply
type: apply-deployment
timeout: 3s
outputs:
- name: resource
valueFrom: output.value
properties:
image: invalid

# if apply step failed, send the resource to chat-gpt to diagnose
- name: chat-diagnose
if: status.apply.failed
type: chat-gpt
inputs:
- from: resource
parameterKey: prompt.content
properties:
token:
# specify your token
value: <your token>
prompt:
type: diagnose

# if apply step succeeded, send the resource to chat-gpt to audit
- name: chat-audit
if: status.apply.succeeded
type: chat-gpt
inputs:
- from: resource
parameterKey: prompt.content
properties:
token:
# or read your token from secret
secretRef:
name: chat-gpt-token-secret
key: token
prompt:
type: audit
lang: Chinese

参数说明 (chat-gpt)

名称描述类型是否必须默认值
tokentype-option-1 or type-option-2true
modelthe model name。stringfalsegpt-3.5-turbo
promptthe prompt to use。prompttrue
timeoutstringfalse30s

type-option-1 (chat-gpt)

名称描述类型是否必须默认值
valuethe token value。stringtrue

type-option-2 (chat-gpt)

名称描述类型是否必须默认值
secretRefsecretReftrue
secretRef (chat-gpt)
名称描述类型是否必须默认值
nameKubernetes Secret 名称。stringtrue
keykey is the token key in the secret。stringtrue

prompt (chat-gpt)

名称描述类型是否必须默认值
type"custom" or "diagnose" or "audit" or "quality-gate"falsecustom
lang"English" or "Chinese"falseEnglish
contentstringtrue

Check-Metrics

描述

Verify application's metrics。

适用范围

该步骤类型适用于 Application 和 WorkflowRun。

示例 (check-metrics)

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: canary-demo
annotations:
app.oam.dev/publishVersion: v2
spec:
components:
- name: canary-demo
type: webservice
properties:
image: wangyikewyk/canarydemo:v2
ports:
- port: 8090
traits:
- type: scaler
properties:
replicas: 5
- type: gateway
properties:
domain: canary-demo.com
http:
"/version": 8090
workflow:
steps:
- name: 200-status-percent-2-phase
type: check-metrics
timeout: 3m
properties:
query: sum(irate(nginx_ingress_controller_requests{host="canary-demo.com",status="200"}[5m]))/sum(irate(nginx_ingress_controller_requests{host="canary-demo.com"}[2m]))
promAddress: "http://prometheus-server.o11y-system.svc:9090"
condition: ">=0.95"
duration: 2m

参数说明 (check-metrics)

名称描述类型是否必须默认值
queryQuery is a raw prometheus query to perform。stringtrue
metricEndpointThe HTTP address and port of the prometheus server。stringfalse
conditionCondition is an expression which determines if a measurement is considered successful. eg: >=0.95。stringtrue
durationDuration defines the duration of time required for this step to be considered successful。stringfalse5m
failDurationFailDuration is the duration of time that, if the check fails, will result in the step being marked as failed。stringfalse2m

Clean-Jobs

描述

clean applied jobs in the cluster。

适用范围

该步骤类型适用于 Application 和 WorkflowRun。

示例 (clean-jobs)

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: clean-jobs
namespace: default
spec:
components: []
workflow:
steps:
- name: clean-cli-jobs
type: clean-jobs
properties:
labelselector:
"my-label": my-value

参数说明 (clean-jobs)

名称描述类型是否必须默认值
labelselectormap[string]_false
namespace|true

Collect-Service-Endpoints

描述

Collect service endpoints for the application。

适用范围

该步骤类型适用于 Application 和 WorkflowRun。

示例 (collect-service-endpoints)

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: app-collect-service-endpoint-and-export
spec:
components:
- type: webservice
name: busybox
properties:
image: busybox
imagePullPolicy: IfNotPresent
cmd:
- sleep
- '1000000'
traits:
- type: expose
properties:
port: [8080]
type: ClusterIP
policies:
- type: topology
name: local
properties:
clusters: ["local"]
- type: topology
name: all
properties:
clusters: ["local", "cluster-worker"]
workflow:
steps:
- type: deploy
name: deploy
properties:
policies: ["local"]
- type: collect-service-endpoints
name: collect-service-endpoints
outputs:
- name: host
valueFrom: value.endpoint.host
- type: export-data
name: export-data
properties:
topology: all
inputs:
- from: host
parameterKey: data.host

参数说明 (collect-service-endpoints)

This capability has no arguments.

Create-Config

描述

Create or update a config。

适用范围

该步骤类型适用于 Application 和 WorkflowRun。

示例 (create-config)

kind: Application
apiVersion: core.oam.dev/v1beta1
metadata:
name: test-config
namespace: "config-e2e-test"
spec:
components: []
workflow:
steps:
- name: write-config
type: create-config
properties:
name: test
config:
key1: value1
key2: 2
key3: true
key4:
key5: value5
- name: read-config
type: read-config
properties:
name: test
outputs:
- fromKey: config
name: read-config
- name: delete-config
type: delete-config
properties:
name: test

参数说明 (create-config)

名称描述类型是否必须默认值
nameSpecify the name of the config。stringtrue
namespaceSpecify the namespace of the config。stringfalse
templateSpecify the template of the config。stringfalse
configSpecify the content of the config。map[string]_true

Delete-Config

描述

Delete a config。

适用范围

该步骤类型适用于 Application 和 WorkflowRun。

示例 (delete-config)

kind: Application
apiVersion: core.oam.dev/v1beta1
metadata:
name: test-config
namespace: "config-e2e-test"
spec:
components: []
workflow:
steps:
- name: write-config
type: create-config
properties:
name: test
config:
key1: value1
key2: 2
key3: true
key4:
key5: value5
- name: delete-config
type: delete-config
properties:
name: test

参数说明 (delete-config)

名称描述类型是否必须默认值
nameSpecify the name of the config。stringtrue
namespaceSpecify the namespace of the config。stringfalse

Depends-On-App

描述

等待指定的 Application 完成。

适用范围

该步骤类型适用于 Application 和 WorkflowRun。

示例 (depends-on-app)

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: first-vela-workflow
namespace: default
spec:
components:
- name: express-server
type: webservice
properties:
image: oamdev/hello-world
port: 8000
traits:
- type: ingress
properties:
domain: testsvc.example.com
http:
/: 8000
workflow:
steps:
- name: express-server
type: depends-on-app
properties:
name: another-app
namespace: default

depends-on-app will check if the cluster has the application with name and namespace given in properties. If the application exists, it will hang the next step until the application is running. If the application does not exist, KubeVela will check the ConfigMap with the same name, and read the config of the Application and apply to cluster. The ConfigMap is like below: the name and namespace of the ConfigMap is the same in properties. In data, the key must be specified by application, and the value is the yaml of the deployed application yaml.

apiVersion: v1
kind: ConfigMap
metadata:
name: myapp
namespace: vela-system
data:
application:
<app yaml file>

参数说明 (depends-on-app)

名称描述类型是否必须默认值
name需要等待的 Application 名称。stringtrue
namespace需要等待的 Application 所在的命名空间。stringtrue

Deploy

描述

功能丰富且统一的用于多集群部署的步骤,可以指定多集群差异化配置策略。

适用范围

该步骤类型只适用于 Application。

示例 (deploy)

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: deploy-workflowstep
namespace: examples
spec:
components:
- name: nginx-deploy-workflowstep
type: webservice
properties:
image: nginx
policies:
- name: topology-hangzhou-clusters
type: topology
properties:
clusterLabelSelector:
region: hangzhou
- name: topology-local
type: topology
properties:
clusters: ["local"]
namespace: examples-alternative
workflow:
steps:
- type: deploy
name: deploy-local
properties:
policies: ["topology-local"]
- type: deploy
name: deploy-hangzhou
properties:
# require manual approval before running this step
auto: false
policies: ["topology-hangzhou-clusters"]

参数说明 (deploy)

名称描述类型是否必须默认值
auto默认为 true。如果为 false,工作流将在执行该步骤前自动暂停。。boolfalsetrue
policies指定本次部署要使用的策略。如果不指定策略,将自动部署到管控集群。[]stringtrue
parallelism指定本次部署的并发度。intfalse5
ignoreTerraformComponent部署时忽略 Terraform 的组件,默认忽略,Terraform 仅需要在管控集群操作云资源,不需要管控信息下发到多集群。boolfalsetrue

Deploy-Cloud-Resource

描述

将云资源生成的秘钥部署到多集群。

适用范围

该步骤类型只适用于 Application。

示例 (deploy-cloud-resource)

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: rds-app
namespace: project-1
spec:
components:
- name: db
type: alibaba-rds
properties:
instance_name: db
account_name: kubevela
password: my-password
writeConnectionSecretToRef:
name: project-1-rds-conn-credential
policies:
- name: env-policy
type: env-binding
properties:
envs:
# 部署 RDS 给杭州集群
- name: hangzhou
placement:
clusterSelector:
name: cluster-hangzhou
patch:
components:
- name: db
type: alibaba-rds
properties:
# region: hangzhou
instance_name: hangzhou_db
# 部署 RDS 给香港集群
- name: hongkong
placement:
clusterSelector:
name: cluster-hongkong
namespaceSelector:
name: hk-project-1
patch:
components:
- name: db
type: alibaba-rds
properties:
# region: hongkong
instance_name: hongkong_db
writeConnectionSecretToRef:
name: hk-project-rds-credential

workflow:
steps:
# 部署 RDS 给杭州区用
- name: deploy-hangzhou-rds
type: deploy-cloud-resource
properties:
env: hangzhou
# 将给杭州区用的 RDS 共享给北京区
- name: share-hangzhou-rds-to-beijing
type: share-cloud-resource
properties:
env: hangzhou
placements:
- cluster: cluster-beijing
# 部署 RDS 给香港区用
- name: deploy-hongkong-rds
type: deploy-cloud-resource
properties:
env: hongkong
# 将给香港区用的 RDS 共享给香港区其他项目用
- name: share-hongkong-rds-to-other-namespace
type: share-cloud-resource
properties:
env: hongkong
placements:
- cluster: cluster-hongkong
namespace: hk-project-2
- cluster: cluster-hongkong
namespace: hk-project-3

参数说明 (deploy-cloud-resource)

名称描述类型是否必须默认值
policyDeclare the name of the env-binding policy, if empty, the first env-binding policy will be used。stringfalseempty
env指定多集群策略中定义的环境名称。stringtrue

Export-Data

描述

Export data to clusters specified by topology。

适用范围

该步骤类型只适用于 Application。

示例 (export-data)

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: app-collect-service-endpoint-and-export
spec:
components:
- type: webservice
name: busybox
properties:
image: busybox
imagePullPolicy: IfNotPresent
cmd:
- sleep
- '1000000'
traits:
- type: expose
properties:
port: [8080]
type: ClusterIP
policies:
- type: topology
name: local
properties:
clusters: ["local"]
- type: topology
name: all
properties:
clusters: ["local", "cluster-worker"]
workflow:
steps:
- type: deploy
name: deploy
properties:
policies: ["local"]
- type: collect-service-endpoints
name: collect-service-endpoints
outputs:
- name: host
valueFrom: value.endpoint.host
- type: export-data
name: export-data
properties:
topology: all
inputs:
- from: host
parameterKey: data.host

参数说明 (export-data)

名称描述类型是否必须默认值
nameSpecify the name of the export destination。stringfalse
namespaceSpecify the namespace of the export destination。stringfalse
kindSpecify the kind of the export destination。"ConfigMap" or "Secret"falseConfigMap
dataSpecify the data to export。structtrue
topologySpecify the topology to export。stringfalse

Export-Service

描述

Export service to clusters specified by topology。

适用范围

该步骤类型只适用于 Application。

示例 (export-service)

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: app-collect-service-endpoint-and-export
spec:
components:
- type: webservice
name: busybox
properties:
image: busybox
imagePullPolicy: IfNotPresent
cmd:
- sleep
- '1000000'
traits:
- type: expose
properties:
port: [8080]
type: LoadBalancer
policies:
- type: topology
name: local
properties:
clusters: ["local"]
- type: topology
name: worker
properties:
clusters: ["cluster-worker"]
workflow:
steps:
- type: deploy
name: deploy
properties:
policies: ["local"]
- type: collect-service-endpoints
name: collect-service-endpoints
outputs:
- name: host
valueFrom: value.endpoint.host
- name: port
valueFrom: value.endpoint.port
- type: export-service
name: export-service
properties:
name: busybox
topology: worker
inputs:
- from: host
parameterKey: ip
- from: port
parameterKey: port

参数说明 (export-service)

名称描述类型是否必须默认值
nameSpecify the name of the export destination。stringfalse
namespaceSpecify the namespace of the export destination。stringfalse
ipSpecify the ip to be export。stringtrue
portSpecify the port to be used in service。inttrue
targetPortSpecify the port to be export。inttrue
topologySpecify the topology to export。stringfalse

Export2config

描述

在工作流中导出数据到 Kubernetes ConfigMap 对象。

适用范围

该步骤类型适用于 Application 和 WorkflowRun。

示例 (export2config)

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: export2config
namespace: default
spec:
components:
- name: export2config-demo-server
type: webservice
properties:
image: oamdev/hello-world
port: 8000
workflow:
steps:
- name: apply-server
type: apply-component
outputs:
- name: status
valueFrom: output.status.conditions[0].message
properties:
component: export2config-demo-server
- name: export-config
type: export2config
inputs:
- from: status
parameterKey: data.serverstatus
properties:
configName: my-configmap
data:
testkey: |
testvalue
value-line-2

参数说明 (export2config)

名称描述类型是否必须默认值
configNameConfigMap 的名称。stringtrue
namespaceConfigMap 的 namespace,默认为当前应用的 namespace。stringfalse
data需要导出到 ConfigMap 中的数据,是一个 key-value 的 map。structtrue
cluster要导出到的集群名称。stringfalseempty

Export2secret

描述

在工作流中导出数据到 Kubernetes Secret 对象。

适用范围

该步骤类型适用于 Application 和 WorkflowRun。

示例 (export2secret)

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: export-secret
namespace: default
spec:
components:
- name: express-server-sec
type: webservice
properties:
image: oamdev/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-sec
- name: export-secret
type: export2secret
inputs:
- from: status
parameterKey: data.serverstatus
properties:
secretName: my-secret
data:
testkey: |
testvalue
value-line-2

参数说明 (export2secret)

名称描述类型是否必须默认值
secretNameSecret 的名称。stringtrue
namespacesecret 的 namespace,默认为当前应用的 namespace。stringfalse
type指定导出的 secret 类型。stringfalse
data需要导出到 Secret 中的数据。structtrue
cluster要导出到的集群名称。stringfalseempty
kindSpecify the kind of the secret。"generic" or "docker-registry"falsegeneric
dockerRegistrySpecify the docker data。dockerRegistryfalse

dockerRegistry (export2secret)

名称描述类型是否必须默认值
usernameSpecify the username of the docker registry。stringtrue
passwordSpecify the password of the docker registry。stringtrue
serverSpecify the server of the docker registry。stringfalsehttps://index.docker.io/v1/

Generate-Jdbc-Connection

描述

Generate a JDBC connection based on Component of alibaba-rds。

适用范围

该步骤类型适用于 Application 和 WorkflowRun。

示例 (generate-jdbc-connection)

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: jdbc
spec:
components:
- name: db
type: alibaba-rds
properties:
instance_name: favorite-links
database_name: db1
account_name: oamtest
password: U34rfwefwefffaked
security_ips: [ "0.0.0.0/0" ]
privilege: ReadWrite
writeConnectionSecretToRef:
name: db-conn
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
port: 8000

workflow:
steps:
- name: jdbc
type: generate-jdbc-connection
outputs:
- name: jdbc
valueFrom: jdbc
properties:
name: db-conn
namespace: default
- name: apply
type: apply-component
inputs:
- from: jdbc
parameterKey: env
properties:
component: express-server

参数说明 (generate-jdbc-connection)

名称描述类型是否必须默认值
nameSpecify the name of the secret generated by database component。stringtrue
namespaceSpecify the namespace of the secret generated by database component。stringfalse

List-Config

描述

List the configs。

适用范围

该步骤类型适用于 Application 和 WorkflowRun。

示例 (list-config)

apiVersion: core.oam.dev/v1alpha1
kind: WorkflowRun
metadata:
name: observability
namespace: vela-system
spec:
context:
readConfig: true
mode:
workflowSpec:
steps:
- name: Enable Prism
type: addon-operation
properties:
addonName: vela-prism

- name: Enable o11y
type: addon-operation
properties:
addonName: o11y-definitions
operation: enable
args:
- --override-definitions

- name: Prepare Prometheus
type: step-group
subSteps:
- name: get-exist-prometheus
type: list-config
properties:
template: prometheus-server
outputs:
- name: prometheus
valueFrom: "output.configs"

- name: prometheus-server
inputs:
- from: prometheus
# TODO: Make it is not required
parameterKey: configs
if: "!context.readConfig || len(inputs.prometheus) == 0"
type: addon-operation
properties:
addonName: prometheus-server
operation: enable
args:
- memory=4096Mi
- serviceType=LoadBalancer

参数说明 (list-config)

名称描述类型是否必须默认值
templateSpecify the template of the config。stringtrue
namespaceSpecify the namespace of the config。stringfalse

Notification

描述

向指定的 Webhook 发送信息,支持邮件、钉钉、Slack 和飞书。

适用范围

该步骤类型适用于 Application 和 WorkflowRun。

示例 (notification)

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: first-vela-workflow
namespace: default
spec:
components:
- name: express-server
type: webservice
properties:
image: oamdev/hello-world
port: 8000
traits:
- type: ingress
properties:
domain: testsvc.example.com
http:
/: 8000
workflow:
steps:
- name: dingtalk-message
type: notification
properties:
dingding:
# the DingTalk webhook address, please refer to: https://developers.dingtalk.com/document/robots/custom-robot-access
url:
value: <url>
message:
msgtype: text
text:
content: Workflow starting...
- name: application
type: apply-application
- name: slack-message
type: notification
properties:
slack:
# the Slack webhook address, please refer to: https://api.slack.com/messaging/webhooks
url:
secretRef:
name: <secret-key>
key: <secret-value>
message:
text: Workflow ended.
lark:
url:
value: <lark-url>
message:
msg_type: "text"
content: "{\"text\":\" Hello KubeVela\"}"
email:
from:
address: <sender-email-address>
alias: <sender-alias>
password:
# secretRef:
# name: <secret-name>
# key: <secret-key>
value: <sender-password>
host: <email host like smtp.gmail.com>
port: <email port, optional, default to 587>
to:
- kubevela1@gmail.com
- kubevela2@gmail.com
content:
subject: test-subject
body: test-body

Expected outcome

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

参数说明 (notification)

名称描述类型是否必须默认值
lark发送飞书信息。larkfalse
dingding发送钉钉信息。dingdingfalse
slack发送 Slack 信息。slackfalse
email发送邮件通知。emailfalse

lark (notification)

名称描述类型是否必须默认值
urlSpecify the the lark url, you can either sepcify it in value or use secretRef。type-option-1 or type-option-2true
messageSpecify the message that you want to sent, refer to Lark messagingmessagetrue
type-option-1 (notification)
名称描述类型是否必须默认值
valuethe url address content in string。stringtrue
type-option-2 (notification)
名称描述类型是否必须默认值
secretRefsecretReftrue
secretRef (notification)
名称描述类型是否必须默认值
nameKubernetes Secret 名称。stringtrue
keyKubernetes Secret 中的 key。stringtrue
message (notification)
名称描述类型是否必须默认值
msg_typemsg_type can be text, post, image, interactive, share_chat, share_user, audio, media, file, sticker。stringtrue
contentcontent should be json encode string。stringtrue

dingding (notification)

名称描述类型是否必须默认值
urlSpecify the the dingding url, you can either sepcify it in value or use secretRef。type-option-1 or type-option-2true
messageSpecify the message that you want to sent, refer to dingtalk messagingmessagetrue
type-option-1 (notification)
名称描述类型是否必须默认值
valuethe url address content in string。stringtrue
type-option-2 (notification)
名称描述类型是否必须默认值
secretRefsecretReftrue
secretRef (notification)
名称描述类型是否必须默认值
nameKubernetes Secret 名称。stringtrue
keyKubernetes Secret 中的 key。stringtrue
message (notification)
名称描述类型是否必须默认值
textSpecify the message content of dingtalk notification。textfalse
msgtypemsgType can be text, link, mardown, actionCard, feedCard。"text" or "link" or "markdown" or "actionCard" or "feedCard"falsetext
linklinkfalse
markdownmarkdownfalse
atatfalse
actionCardactionCardfalse
feedCardfeedCardfalse
text (notification)
名称描述类型是否必须默认值
contentstringtrue
名称描述类型是否必须默认值
textstringfalse
titlestringfalse
messageUrlstringfalse
picUrlstringfalse
markdown (notification)
名称描述类型是否必须默认值
textstringtrue
titlestringtrue
at (notification)
名称描述类型是否必须默认值
atMobiles[]stringfalse
isAtAllboolfalse
actionCard (notification)
名称描述类型是否必须默认值
textstringtrue
titlestringtrue
hideAvatarstringtrue
btnOrientationstringtrue
singleTitlestringtrue
singleURLstringtrue
btns[]btnsfalse
btns (notification)
名称描述类型是否必须默认值
titlestringtrue
actionURLstringtrue
feedCard (notification)
名称描述类型是否必须默认值
links[]linkstrue
名称描述类型是否必须默认值
textstringfalse
titlestringfalse
messageUrlstringfalse
picUrlstringfalse

slack (notification)

名称描述类型是否必须默认值
urlSlack 的 Webhook 地址,可以选择直接在 value 填写或从 secretRef 中获取。type-option-1 or type-option-2true
messageSpecify the message that you want to sent, refer to slack messagingmessagetrue
type-option-1 (notification)
名称描述类型是否必须默认值
valuethe url address content in string。stringtrue
type-option-2 (notification)
名称描述类型是否必须默认值
secretRefsecretReftrue
secretRef (notification)
名称描述类型是否必须默认值
nameKubernetes Secret 名称。stringtrue
keyKubernetes Secret 中的 key。stringtrue
message (notification)
名称描述类型是否必须默认值
textSpecify the message text for slack notification。stringtrue
blocks[]blocksfalse
attachmentsattachmentsfalse
thread_tsstringfalse
mrkdwnSpecify the message text format in markdown for slack notification。boolfalsetrue
blocks (notification)
名称描述类型是否必须默认值
typestringtrue
block_idstringfalse
elements[]elementsfalse
elements (notification)
名称描述类型是否必须默认值
typestringtrue
action_idstringfalse
urlstringfalse
valuestringfalse
stylestringfalse
texttextfalse
confirmconfirmfalse
options[]optionsfalse
initial_options[]initial_optionsfalse
placeholderplaceholderfalse
initial_datestringfalse
image_urlstringfalse
alt_textstringfalse
option_groups[]option_groupsfalse
max_selected_itemsintfalse
initial_valuestringfalse
multilineboolfalse
min_lengthintfalse
max_lengthintfalse
dispatch_action_configdispatch_action_configfalse
initial_timestringfalse
text (notification)
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
confirm (notification)
名称描述类型是否必须默认值
titletitletrue
texttexttrue
confirmconfirmtrue
denydenytrue
stylestringfalse
title (notification)
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
text (notification)
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
confirm (notification)
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
deny (notification)
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
options (notification)
名称描述类型是否必须默认值
texttexttrue
valuestringtrue
descriptiondescriptionfalse
urlstringfalse
text (notification)
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
description (notification)
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
initial_options (notification)
名称描述类型是否必须默认值
texttexttrue
valuestringtrue
descriptiondescriptionfalse
urlstringfalse
text (notification)
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
description (notification)
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
placeholder (notification)
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
option_groups (notification)
名称描述类型是否必须默认值
texttexttrue
valuestringtrue
descriptiondescriptionfalse
urlstringfalse
text (notification)
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
description (notification)
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
dispatch_action_config (notification)
名称描述类型是否必须默认值
trigger_actions_on[]stringfalse
attachments (notification)
名称描述类型是否必须默认值
blocks[]blocksfalse
colorstringfalse
blocks (notification)
名称描述类型是否必须默认值
typestringtrue
block_idstringfalse
elements[]elementsfalse
elements (notification)
名称描述类型是否必须默认值
typestringtrue
action_idstringfalse
urlstringfalse
valuestringfalse
stylestringfalse
texttextfalse
confirmconfirmfalse
options[]optionsfalse
initial_options[]initial_optionsfalse
placeholderplaceholderfalse
initial_datestringfalse
image_urlstringfalse
alt_textstringfalse
option_groups[]option_groupsfalse
max_selected_itemsintfalse
initial_valuestringfalse
multilineboolfalse
min_lengthintfalse
max_lengthintfalse
dispatch_action_configdispatch_action_configfalse
initial_timestringfalse
text (notification)
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
confirm (notification)
名称描述类型是否必须默认值
titletitletrue
texttexttrue
confirmconfirmtrue
denydenytrue
stylestringfalse
title (notification)
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
text (notification)
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
confirm (notification)
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
deny (notification)
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
options (notification)
名称描述类型是否必须默认值
texttexttrue
valuestringtrue
descriptiondescriptionfalse
urlstringfalse
text (notification)
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
description (notification)
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
initial_options (notification)
名称描述类型是否必须默认值
texttexttrue
valuestringtrue
descriptiondescriptionfalse
urlstringfalse
text (notification)
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
description (notification)
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
placeholder (notification)
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
option_groups (notification)
名称描述类型是否必须默认值
texttexttrue
valuestringtrue
descriptiondescriptionfalse
urlstringfalse
text (notification)
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
description (notification)
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
dispatch_action_config (notification)
名称描述类型是否必须默认值
trigger_actions_on[]stringfalse

email (notification)

名称描述类型是否必须默认值
from指定邮件发送人信息。fromtrue
to指定收件人信息。[]stringtrue
content指定邮件内容。contenttrue
from (notification)
名称描述类型是否必须默认值
address发件人邮件地址。stringtrue
aliasThe alias is the email alias to show after sending the email。stringfalse
passwordSpecify the password of the email, you can either sepcify it in value or use secretRef。type-option-1 or type-option-2true
hostSpecify the host of your email。stringtrue
portSpecify the port of the email host, default to 587。intfalse587
type-option-1 (notification)
名称描述类型是否必须默认值
valuethe password content in string。stringtrue
type-option-2 (notification)
名称描述类型是否必须默认值
secretRefsecretReftrue
secretRef (notification)
名称描述类型是否必须默认值
nameKubernetes Secret 名称。stringtrue
keyKubernetes Secret 中的 key。stringtrue
content (notification)
名称描述类型是否必须默认值
subject指定邮件标题。stringtrue
body指定邮件正文内容。stringtrue

描述

print message in workflow step status。

适用范围

该步骤类型适用于 Application 和 WorkflowRun。

示例 (print-message-in-status)

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: print-message-in-status
namespace: default
spec:
components:
- name: express-server
type: webservice
properties:
image: oamdev/hello-world
port: 8000
workflow:
steps:
- name: express-server
type: apply-component
properties:
component: express-server
- name: message
type: print-message-in-status
properties:
message: "All addons have been enabled successfully, you can use 'vela addon list' to check them."

参数说明 (print-message-in-status)

名称描述类型是否必须默认值
messagestringtrue

Read-App

描述

Read application from the cluster。

适用范围

该步骤类型只适用于 WorkflowRun。

示例 (read-app)

apiVersion: core.oam.dev/v1alpha1
kind: WorkflowRun
metadata:
name: apply-applications
namespace: default
annotations:
workflowrun.oam.dev/debug: "true"
spec:
workflowSpec:
steps:
- name: check-app-exist
type: read-app
properties:
name: webservice-app
- name: apply-app1
type: apply-app
if: status["check-app-exist"].message == "Application not found"
properties:
data:
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: webservice-app
spec:
components:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
ports:
- port: 8000
- name: suspend
type: suspend
timeout: 24h
- name: apply-app2
type: apply-app
properties:
ref:
name: my-app
key: application
type: configMap
---
apiVersion: v1
kind: ConfigMap
metadata:
name: my-app
namespace: default
data:
application: |
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: webservice-app2
spec:
components:
- name: express-server2
type: webservice
properties:
image: crccheck/hello-world
ports:
- port: 8000

参数说明 (read-app)

名称描述类型是否必须默认值
namestringtrue
namespace|true

Read-Config

描述

Read a config。

适用范围

该步骤类型适用于 Application 和 WorkflowRun。

示例 (read-config)

kind: Application
apiVersion: core.oam.dev/v1beta1
metadata:
name: test-config
namespace: "config-e2e-test"
spec:
components: []
workflow:
steps:
- name: read-config
type: read-config
properties:
name: test
outputs:
- fromKey: config
name: read-config

参数说明 (read-config)

名称描述类型是否必须默认值
nameSpecify the name of the config。stringtrue
namespaceSpecify the namespace of the config。stringfalse

Read-Object

描述

在工作流中读取 Kubernetes 资源对象。

适用范围

该步骤类型适用于 Application 和 WorkflowRun。

示例 (read-object)

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: read-object
namespace: default
spec:
components:
- name: express-server
type: webservice
properties:
image: oamdev/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
cluster: <your cluster name
- name: apply
type: apply-component
inputs:
- from: cpu
parameterKey: cpu
- from: memory
parameterKey: memory
properties:
component: express-server

参数说明 (read-object)

名称描述类型是否必须默认值
apiVersionSpecify the apiVersion of the object, defaults to 'core.oam.dev/v1beta1'。stringfalse
kindSpecify the kind of the object, defaults to Application。stringfalse
nameSpecify the name of the object。stringtrue
namespaceThe namespace of the resource you want to read。stringfalsedefault
cluster需要部署的集群名称。如果不指定,则为当前集群。stringfalseempty

Request

描述

Send request to the url。

适用范围

该步骤类型适用于 Application 和 WorkflowRun。

示例 (request)

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: request-http
namespace: default
spec:
components: []
workflow:
steps:
- name: request
type: request
properties:
url: https://api.github.com/repos/kubevela/workflow
outputs:
- name: stars
valueFrom: |
import "strconv"
"Current star count: " + strconv.FormatInt(response["stargazers_count"], 10)
- name: notification
type: notification
inputs:
- from: stars
parameterKey: slack.message.text
properties:
slack:
url:
value: <your slack url>
- name: failed-notification
type: notification
if: status.request.failed
properties:
slack:
url:
value: <your slack url>
message:
text: "Failed to request github"

参数说明 (request)

名称描述类型是否必须默认值
urlstringtrue
method"GET" or "POST" or "PUT" or "DELETE"falseGET
bodymap[string]_false
headermap[string]stringfalse

Share-Cloud-Resource

描述

Sync secrets created by terraform component to runtime clusters so that runtime clusters can share the created cloud resource。

适用范围

该步骤类型只适用于 Application。

示例 (share-cloud-resource)

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: rds-app
namespace: project-1
spec:
components:
- name: db
type: alibaba-rds
properties:
instance_name: db
account_name: kubevela
password: my-password
writeConnectionSecretToRef:
name: project-1-rds-conn-credential
policies:
- name: env-policy
type: env-binding
properties:
envs:
# 部署 RDS 给杭州集群
- name: hangzhou
placement:
clusterSelector:
name: cluster-hangzhou
patch:
components:
- name: db
type: alibaba-rds
properties:
# region: hangzhou
instance_name: hangzhou_db
# 部署 RDS 给香港集群
- name: hongkong
placement:
clusterSelector:
name: cluster-hongkong
namespaceSelector:
name: hk-project-1
patch:
components:
- name: db
type: alibaba-rds
properties:
# region: hongkong
instance_name: hongkong_db
writeConnectionSecretToRef:
name: hk-project-rds-credential

workflow:
steps:
# 部署 RDS 给杭州区用
- name: deploy-hangzhou-rds
type: deploy-cloud-resource
properties:
env: hangzhou
# 将给杭州区用的 RDS 共享给北京区
- name: share-hangzhou-rds-to-beijing
type: share-cloud-resource
properties:
env: hangzhou
placements:
- cluster: cluster-beijing
# 部署 RDS 给香港区用
- name: deploy-hongkong-rds
type: deploy-cloud-resource
properties:
env: hongkong
# 将给香港区用的 RDS 共享给香港区其他项目用
- name: share-hongkong-rds-to-other-namespace
type: share-cloud-resource
properties:
env: hongkong
placements:
- cluster: cluster-hongkong
namespace: hk-project-2
- cluster: cluster-hongkong
namespace: hk-project-3

参数说明 (share-cloud-resource)

名称描述类型是否必须默认值
placementsDeclare the location to bind。[]placementstrue
policyDeclare the name of the env-binding policy, if empty, the first env-binding policy will be used。stringfalseempty
env指定多集群策略中定义的环境名称。stringtrue

placements (share-cloud-resource)

名称描述类型是否必须默认值
namespacestringfalse
clusterstringfalse

Step-Group

描述

A special step that you can declare 'subSteps' in it, 'subSteps' is an array containing any step type whose valid parameters do not include the step-group step type itself. The sub steps were executed in parallel。

适用范围

该步骤类型适用于 Application 和 WorkflowRun。

示例 (step-group)

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: example
namespace: default
spec:
components:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
port: 8000
- name: express-server2
type: webservice
properties:
image: crccheck/hello-world
port: 8000

workflow:
steps:
- name: step
type: step-group
subSteps:
- name: apply-sub-step1
type: apply-component
properties:
component: express-server
- name: apply-sub-step2
type: apply-component
properties:
component: express-server2

参数说明 (step-group)

This capability has no arguments.

Suspend

描述

暂停当前工作流,可以通过 'vela workflow resume' 继续已暂停的工作流。

适用范围

该步骤类型适用于 Application 和 WorkflowRun。

示例 (suspend)

The duration parameter is supported in KubeVela v1.4 or higher.

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: first-vela-workflow
namespace: default
spec:
components:
- name: express-server
type: webservice
properties:
image: oamdev/hello-world
port: 8000
workflow:
steps:
- name: slack-message
type: notification
properties:
slack:
url:
value: <your-slack-url>
# the Slack webhook address, please refer to: https://api.slack.com/messaging/webhooks
message:
text: Ready to apply the application, ask the administrator to approve and resume the workflow.
- name: manual-approval
type: suspend
# properties:
# duration: "30s"
- name: express-server
type: apply-component
properties:
component: express-server

参数说明 (suspend)

名称描述类型是否必须默认值
duration指定工作流暂停的时长,超过该时间后工作流将自动继续,如:"30s", "1min", "2m15s"。stringfalse
messageThe suspend message to show。stringfalse

Vela-Cli

描述

Run a vela command。

适用范围

该步骤类型适用于 Application 和 WorkflowRun。

示例 (vela-cli)

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: vela-cli
namespace: default
spec:
components: []
workflow:
steps:
- name: list-app
type: vela-cli
properties:
command:
- vela
- ls

参数说明 (vela-cli)

名称描述类型是否必须默认值
addonNameSpecify the name of the addon。stringtrue
commandSpecify the vela command。[]stringtrue
imageSpecify the image。stringfalseoamdev/vela-cli:v1.6.4
serviceAccountNamespecify serviceAccountName want to use。stringfalsekubevela-vela-core
storagestoragefalse

storage (vela-cli)

名称描述类型是否必须默认值
secretMount Secret type storage。[]secretfalse
hostPathDeclare host path type storage。[]hostPathfalse
secret (vela-cli)
名称描述类型是否必须默认值
namestringtrue
mountPathstringtrue
subPathstringfalse
defaultModeintfalse420
secretNamestringtrue
items[]itemsfalse
items (vela-cli)
名称描述类型是否必须默认值
keystringtrue
pathstringtrue
modeintfalse511
hostPath (vela-cli)
名称描述类型是否必须默认值
namestringtrue
pathstringtrue
mountPathstringtrue
type"Directory" or "DirectoryOrCreate" or "FileOrCreate" or "File" or "Socket" or "CharDevice" or "BlockDevice"falseDirectory

Webhook

描述

Send a POST request to the specified Webhook URL. If no request body is specified, the current Application body will be sent by default。

适用范围

该步骤类型适用于 Application 和 WorkflowRun。

示例 (webhook)

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: first-vela-workflow
namespace: default
spec:
components:
- name: express-server
type: webservice
properties:
image: oamdev/hello-world
port: 8000
workflow:
steps:
- name: express-server
type: apply-application
- name: webhook
type: webhook
properties:
url:
value: <your webhook url>

参数说明 (webhook)

名称描述类型是否必须默认值
url需要发送的 Webhook URL,可以选择直接在 value 填写或从 secretRef 中获取。type-option-1 or type-option-2true
data需要发送的内容。map[string]_false

type-option-1 (webhook)

名称描述类型是否必须默认值
valuestringtrue

type-option-2 (webhook)

名称描述类型是否必须默认值
secretRefsecretReftrue
secretRef (webhook)
名称描述类型是否必须默认值
nameKubernetes Secret 名称。stringtrue
keyKubernetes Secret 中的 key。stringtrue