内置工作流步骤列表
本文档将按字典序展示所有内置工作流步骤的参数列表。
本文档由脚本自动生成,请勿手动修改,上次更新于 2023-01-16T19:19:03+08:00。
Enable a KubeVela addon。
该步骤类型只适用于 WorkflowRun。
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."
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
addonName | Specify the name of the addon。 | string | true | |
args | Specify addon enable args。 | []string | false | |
image | Specify the image。 | string | false | oamdev/vela-cli:v1.6.4 |
operation | operation for the addon。 | “enable” or “upgrade” or “disable” | false | enable |
serviceAccountName | specify serviceAccountName want to use。 | string | false | kubevela-vela-core |
Apply application from data or ref to the cluster。
该步骤类型只适用于 WorkflowRun。
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
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
data | | map[string]_ | false | |
ref | | ref | false | |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
name | | string | true | |
namespace | | | | true | |
type | | string | false | configMap |
key | | string | false | application |
Apply a specific component and its corresponding traits in application。
该步骤类型只适用于 Application。
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>
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
component | Specify the component name to apply。 | string | true | |
cluster | Specify the cluster。 | string | false | empty |
Apply deployment with specified image and cmd。
该步骤类型适用于 Application 和 WorkflowRun。
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
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
image | | string | true | |
cmd | | []string | false | |
在工作流中部署 Kubernetes 资源对象。
该步骤类型适用于 Application 和 WorkflowRun。
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
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
value | Kubernetes 资源对象参数。 | map[string]_ | true | |
cluster | 需要部署的集群名称。如果不指定,则为当前集群。 | string | false | empty |
Apply terraform configuration in the step。
该步骤类型适用于 Application 和 WorkflowRun。
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"
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
source | specify the source of the terraform configuration。 | type-option-1 or type-option-2 | true | |
deleteResource | whether to delete resource。 | bool | false | true |
variable | the variable in the configuration。 | map[string] | true | |
writeConnectionSecretToRef | this specifies the namespace and name of a secret to which any connection details for this managed resource should be written。 | writeConnectionSecretToRef | false | |
providerRef | providerRef specifies the reference to Provider。 | providerRef | false | |
region | region is cloud provider’s region. It will override the region in the region field of providerRef。 | string | false | |
jobEnv | the envs for job。 | map[string] | false | |
forceDelete | | bool | false | false |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
hcl | directly specify the hcl of the terraform configuration。 | string | true | |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
name | | string | true | |
namespace | | | | true | |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
name | | string | true | |
namespace | | | | true | |
Apply terraform provider config。
该步骤类型适用于 Application 和 WorkflowRun。
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
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
type | | string | true | |
accessKey | | string | true | |
secretKey | | string | true | |
name | | string | false | alibaba-provider |
region | | string | true | |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
token | | string | false | empty |
type | | string | true | |
accessKey | | string | true | |
secretKey | | string | true | |
name | | string | false | aws-provider |
region | | string | true | |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
subscriptionID | | string | true | |
tenantID | | string | true | |
clientID | | string | true | |
clientSecret | | string | true | |
name | | string | false | azure-provider |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
type | | string | true | |
accessKey | | string | true | |
secretKey | | string | true | |
name | | string | false | baidu-provider |
region | | string | true | |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
type | | string | true | |
apiKey | | string | false | empty |
name | | string | true | |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
credentials | | string | true | |
region | | string | true | |
project | | string | true | |
type | | string | true | |
name | | string | false | gcp-provider |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
secretID | | string | true | |
secretKey | | string | true | |
region | | string | true | |
type | | string | true | |
name | | string | false | tencent-provider |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
publicKey | | string | true | |
privateKey | | string | true | |
projectID | | string | true | |
region | | string | true | |
type | | string | true | |
name | | string | false | ucloud-provider |
Build and push image from git url。
该步骤类型适用于 Application 和 WorkflowRun。
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
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
kanikoExecutor | Specify the kaniko executor image, default to oamdev/kaniko-executor:v1.9.1。 | string | false | oamdev/kaniko-executor:v1.9.1 |
context | Specify 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。 | string | true | |
dockerfile | Specify the dockerfile。 | string | false | ./Dockerfile |
image | Specify the image。 | string | true | |
platform | Specify the platform to build。 | string | false | |
buildArgs | Specify the build args。 | []string | false | |
credentials | Specify the credentials to access git and image registry。 | credentials | false | |
verbosity | Specify the verbosity level。 | “info” or “panic” or “fatal” or “error” or “warn” or “debug” or “trace” | false | info |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
git | Specify the credentials to access git。 | git | false | |
image | Specify the credentials to access image registry。 | image | false | |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
name | Specify the secret name。 | string | true | |
key | Specify the secret key。 | string | true | |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
name | Specify the secret name。 | string | true | |
key | Specify the secret key。 | string | false | .dockerconfigjson |
clean applied jobs in the cluster。
该步骤类型适用于 Application 和 WorkflowRun。
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
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
labelselector | | map[string]_ | false | |
namespace | | | | true | |
Collect service endpoints for the application。
该步骤类型适用于 Application 和 WorkflowRun。
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
This capability has no arguments.
Create or update a config。
该步骤类型适用于 Application 和 WorkflowRun。
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
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
name | Specify the name of the config。 | string | true | |
namespace | Specify the namespace of the config。 | string | false | |
template | Specify the template of the config。 | string | false | |
config | Specify the content of the config。 | map[string]_ | true | |
Delete a config。
该步骤类型适用于 Application 和 WorkflowRun。
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
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
name | Specify the name of the config。 | string | true | |
namespace | Specify the namespace of the config。 | string | false | |
等待指定的 Application 完成。
该步骤类型适用于 Application 和 WorkflowRun。
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>
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
name | 需要等待的 Application 名称。 | string | true | |
namespace | 需要等待的 Application 所在的命名空间。 | string | true | |
功能丰富且统一的用于多集群部署的步骤,可以指定多集群差异化配置策略。
该步骤类型只适用于 Application。
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"]
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
auto | 默认为 true。如果为 false,工作流将在执行该步骤前自动暂停。。 | bool | false | true |
policies | 指定本次部署要使用的策略。如果不指定策略,将自动部署到管控集群。 | []string | false | |
parallelism | 指定本次部署的并发度。 | int | false | 5 |
ignoreTerraformComponent | 部署时忽略 Terraform 的组件,默认忽略,Terraform 仅需要在管控集群操作云资源,不需要管控信息下发到多集群。 | bool | false | true |
将云资源生成的秘钥部署到多集群。
该步骤类型只适用于 Application。
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
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
policy | Declare the name of the env-binding policy, if empty, the first env-binding policy will be used。 | string | false | empty |
env | 指定多集群策略中定义的环境名称。 | string | true | |
Export data to clusters specified by topology。
该步骤类型适用于 Application 和 WorkflowRun。
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
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
name | Specify the name of the export destination。 | string | false | |
namespace | Specify the namespace of the export destination。 | string | false | |
kind | Specify the kind of the export destination。 | “ConfigMap” or “Secret” | false | ConfigMap |
data | Specify the data to export。 | struct | true | |
topology | Specify the topology to export。 | string | false | |
Export service to clusters specified by topology。
该步骤类型适用于 Application 和 WorkflowRun。
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
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
name | Specify the name of the export destination。 | string | false | |
namespace | Specify the namespace of the export destination。 | string | false | |
ip | Specify the ip to be export。 | string | true | |
port | Specify the port to be used in service。 | int | true | |
targetPort | Specify the port to be export。 | int | true | |
topology | Specify the topology to export。 | string | false | |
在工作流中导出数据到 Kubernetes ConfigMap 对象。
该步骤类型适用于 Application 和 WorkflowRun。
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
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
configName | ConfigMap 的名称。 | string | true | |
namespace | ConfigMap 的 namespace,默认为当前应用的 namespace。 | string | false | |
data | 需要导出到 ConfigMap 中的数据,是一个 key-value 的 map。 | struct | true | |
cluster | 要导出到的集群名称。 | string | false | empty |
在工作流中导出数据到 Kubernetes Secret 对象。
该步骤类型适用于 Application 和 WorkflowRun。
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
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
secretName | Secret 的名称。 | string | true | |
namespace | secret 的 namespace,默认为当前应用的 namespace。 | string | false | |
type | 指定导出的 secret 类型。 | string | false | |
data | 需要导出到 Secret 中的数据。 | struct | true | |
cluster | 要导出到的集群名称。 | string | false | empty |
kind | Specify the kind of the secret。 | “generic” or “docker-registry” | false | generic |
dockerRegistry | Specify the docker data。 | dockerRegistry | false | |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
username | Specify the username of the docker registry。 | string | true | |
password | Specify the password of the docker registry。 | string | true | |
server | Specify the server of the docker registry。 | string | false | https://index.docker.io/v1/ |
Generate a JDBC connection based on Component of alibaba-rds。
该步骤类型适用于 Application 和 WorkflowRun。
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
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
name | Specify the name of the secret generated by database component。 | string | true | |
namespace | Specify the namespace of the secret generated by database component。 | string | false | |
List the configs。
该步骤类型适用于 Application 和 WorkflowRun。
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
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
template | Specify the template of the config。 | string | true | |
namespace | Specify the namespace of the config。 | string | false | |
向指定的 Webhook 发送信息,支持邮件、钉钉、Slack 和飞书。
该步骤类型适用于 Application 和 WorkflowRun。
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.
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
lark | 发送飞书信息。 | lark | false | |
dingding | 发送钉钉信息。 | dingding | false | |
slack | 发送 Slack 信息。 | slack | false | |
email | 发送邮件通知。 | email | false | |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
value | the url address content in string。 | string | true | |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
name | Kubernetes Secret 名称。 | string | true | |
key | Kubernetes Secret 中的 key。 | string | true | |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
msg_type | msg_type can be text, post, image, interactive, share_chat, share_user, audio, media, file, sticker。 | string | true | |
content | content should be json encode string。 | string | true | |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
value | the url address content in string。 | string | true | |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
name | Kubernetes Secret 名称。 | string | true | |
key | Kubernetes Secret 中的 key。 | string | true | |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
text | Specify the message content of dingtalk notification。 | null | false | |
msgtype | msgType can be text, link, mardown, actionCard, feedCard。 | “text” or “link” or “markdown” or “actionCard” or “feedCard” | false | text |
link | | null | false | |
markdown | | null | false | |
at | | null | false | |
actionCard | | null | false | |
feedCard | | null | false | |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
value | the url address content in string。 | string | true | |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
name | Kubernetes Secret 名称。 | string | true | |
key | Kubernetes Secret 中的 key。 | string | true | |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
text | Specify the message text for slack notification。 | string | true | |
blocks | | null | false | |
attachments | | null | false | |
thread_ts | | string | false | |
mrkdwn | Specify the message text format in markdown for slack notification。 | bool | false | true |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
from | 指定邮件发送人信息。 | from | true | |
to | 指定收件人信息。 | []string | true | |
content | 指定邮件内容。 | content | true | |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
address | 发件人邮件地址。 | string | true | |
alias | The alias is the email alias to show after sending the email。 | string | false | |
password | Specify the password of the email, you can either sepcify it in value or use secretRef。 | type-option-1 or type-option-2 | true | |
host | Specify the host of your email。 | string | true | |
port | Specify the port of the email host, default to 587。 | int | false | 587 |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
value | the password content in string。 | string | true | |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
name | Kubernetes Secret 名称。 | string | true | |
key | Kubernetes Secret 中的 key。 | string | true | |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
subject | 指定邮件标题。 | string | true | |
body | 指定邮件正文内容。 | string | true | |
print message in workflow step status。
该步骤类型适用于 Application 和 WorkflowRun。
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."
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
message | | string | true | |
Read application from the cluster。
该步骤类型只适用于 WorkflowRun。
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
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
name | | string | true | |
namespace | | | | true | |
Read a config。
该步骤类型适用于 Application 和 WorkflowRun。
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
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
name | Specify the name of the config。 | string | true | |
namespace | Specify the namespace of the config。 | string | false | |
在工作流中读取 Kubernetes 资源对象。
该步骤类型适用于 Application 和 WorkflowRun。
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
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
apiVersion | Specify the apiVersion of the object, defaults to ‘core.oam.dev/v1beta1’。 | string | false | |
kind | Specify the kind of the object, defaults to Application。 | string | false | |
name | Specify the name of the object。 | string | true | |
namespace | The namespace of the resource you want to read。 | string | false | default |
cluster | 需要部署的集群名称。如果不指定,则为当前集群。 | string | false | empty |
Send request to the url。
该步骤类型适用于 Application 和 WorkflowRun。
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"
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
url | | string | true | |
method | | “GET” or “POST” or “PUT” or “DELETE” | false | GET |
body | | map[string]_ | false | |
header | | map[string]string | false | |
Sync secrets created by terraform component to runtime clusters so that runtime clusters can share the created cloud resource。
该步骤类型只适用于 Application。
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
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
placements | Declare the location to bind。 | []placements | true | |
policy | Declare the name of the env-binding policy, if empty, the first env-binding policy will be used。 | string | false | empty |
env | 指定多集群策略中定义的环境名称。 | string | true | |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
namespace | | string | false | |
cluster | | string | false | |
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。
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
This capability has no arguments.
暂停当前工作流,可以通过 ‘vela workflow resume’ 继续已暂停的工作流。
该步骤类型适用于 Application 和 WorkflowRun。
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
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
duration | 指定工作流暂停的时长,超过该时间后工作流将自动继续,如:”30s”, “1min”, “2m15s”。 | string | false | |
Run a vela command。
该步骤类型适用于 Application 和 WorkflowRun。
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
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
addonName | Specify the name of the addon。 | string | true | |
command | Specify the vela command。 | []string | true | |
image | Specify the image。 | string | false | oamdev/vela-cli:v1.6.4 |
serviceAccountName | specify serviceAccountName want to use。 | string | false | kubevela-vela-core |
storage | | storage | false | |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
secret | Mount Secret type storage。 | []secret | false | |
hostPath | Declare host path type storage。 | []hostPath | false | |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
name | | string | true | |
mountPath | | string | true | |
subPath | | string | false | |
defaultMode | | int | false | 420 |
secretName | | string | true | |
items | | []items | false | |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
key | | string | true | |
path | | string | true | |
mode | | int | false | 511 |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
name | | string | true | |
path | | string | true | |
mountPath | | string | true | |
type | | “Directory” or “DirectoryOrCreate” or “FileOrCreate” or “File” or “Socket” or “CharDevice” or “BlockDevice” | false | Directory |
向指定 Webhook URL 发送请求,若不指定请求体,则默认发送当前 Application。
该步骤类型适用于 Application 和 WorkflowRun。
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>
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
url | 需要发送的 Webhook URL,可以选择直接在 value 填写或从 secretRef 中获取。 | type-option-1 or type-option-2 | true | |
data | 需要发送的内容。 | map[string]_ | false | |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
value | | string | true | |
名称 | 描述 | 类型 | 是否必须 | 默认值 |
---|
name | Kubernetes Secret 名称。 | string | true | |
key | Kubernetes Secret 中的 key。 | string | true | |
Last updated on 2023年2月9日 by dependabot[bot]