内置工作流步骤列表

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

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

Enable a KubeVela addon。

该步骤类型只适用于 WorkflowRun。

  1. apiVersion: core.oam.dev/v1alpha1
  2. kind: WorkflowRun
  3. metadata:
  4. name: observability
  5. namespace: vela-system
  6. spec:
  7. context:
  8. readConfig: true
  9. mode:
  10. workflowSpec:
  11. steps:
  12. - name: Enable Prism
  13. type: addon-operation
  14. properties:
  15. addonName: vela-prism
  16. - name: Enable o11y
  17. type: addon-operation
  18. properties:
  19. addonName: o11y-definitions
  20. operation: enable
  21. args:
  22. - --override-definitions
  23. - name: Prepare Prometheus
  24. type: step-group
  25. subSteps:
  26. - name: get-exist-prometheus
  27. type: list-config
  28. properties:
  29. template: prometheus-server
  30. outputs:
  31. - name: prometheus
  32. valueFrom: "output.configs"
  33. - name: prometheus-server
  34. inputs:
  35. - from: prometheus
  36. # TODO: Make it is not required
  37. parameterKey: configs
  38. if: "!context.readConfig || len(inputs.prometheus) == 0"
  39. type: addon-operation
  40. properties:
  41. addonName: prometheus-server
  42. operation: enable
  43. args:
  44. - memory=4096Mi
  45. - serviceType=LoadBalancer
  46. - name: Prepare Loki
  47. type: addon-operation
  48. properties:
  49. addonName: loki
  50. operation: enable
  51. args:
  52. - --version=v0.1.4
  53. - agent=vector
  54. - serviceType=LoadBalancer
  55. - name: Prepare Grafana
  56. type: step-group
  57. subSteps:
  58. - name: get-exist-grafana
  59. type: list-config
  60. properties:
  61. template: grafana
  62. outputs:
  63. - name: grafana
  64. valueFrom: "output.configs"
  65. - name: Install Grafana & Init Dashboards
  66. inputs:
  67. - from: grafana
  68. parameterKey: configs
  69. if: "!context.readConfig || len(inputs.grafana) == 0"
  70. type: addon-operation
  71. properties:
  72. addonName: grafana
  73. operation: enable
  74. args:
  75. - serviceType=LoadBalancer
  76. - name: Init Dashboards
  77. inputs:
  78. - from: grafana
  79. parameterKey: configs
  80. if: "len(inputs.grafana) != 0"
  81. type: addon-operation
  82. properties:
  83. addonName: grafana
  84. operation: enable
  85. args:
  86. - install=false
  87. - name: Clean
  88. type: clean-jobs
  89. - name: print-message
  90. type: print-message-in-status
  91. properties:
  92. message: "All addons have been enabled successfully, you can use 'vela addon list' to check them."
名称描述类型是否必须默认值
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 application from data or ref to the cluster。

该步骤类型只适用于 WorkflowRun。

  1. apiVersion: core.oam.dev/v1alpha1
  2. kind: WorkflowRun
  3. metadata:
  4. name: apply-applications
  5. namespace: default
  6. annotations:
  7. workflowrun.oam.dev/debug: "true"
  8. spec:
  9. workflowSpec:
  10. steps:
  11. - name: check-app-exist
  12. type: read-app
  13. properties:
  14. name: webservice-app
  15. - name: apply-app1
  16. type: apply-app
  17. if: status["check-app-exist"].message == "Application not found"
  18. properties:
  19. data:
  20. apiVersion: core.oam.dev/v1beta1
  21. kind: Application
  22. metadata:
  23. name: webservice-app
  24. spec:
  25. components:
  26. - name: express-server
  27. type: webservice
  28. properties:
  29. image: crccheck/hello-world
  30. ports:
  31. - port: 8000
  32. - name: suspend
  33. type: suspend
  34. timeout: 24h
  35. - name: apply-app2
  36. type: apply-app
  37. properties:
  38. ref:
  39. name: my-app
  40. key: application
  41. type: configMap
  42. ---
  43. apiVersion: v1
  44. kind: ConfigMap
  45. metadata:
  46. name: my-app
  47. namespace: default
  48. data:
  49. application: |
  50. apiVersion: core.oam.dev/v1beta1
  51. kind: Application
  52. metadata:
  53. name: webservice-app2
  54. spec:
  55. components:
  56. - name: express-server2
  57. type: webservice
  58. properties:
  59. image: crccheck/hello-world
  60. ports:
  61. - port: 8000
名称描述类型是否必须默认值
datamap[string]_false
refreffalse
名称描述类型是否必须默认值
namestringtrue
namespace|true
typestringfalseconfigMap
keystringfalseapplication

Apply a specific component and its corresponding traits in application。

该步骤类型只适用于 Application。

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: first-vela-workflow
  5. namespace: default
  6. spec:
  7. components:
  8. - name: express-server
  9. type: webservice
  10. properties:
  11. image: oamdev/hello-world
  12. port: 8000
  13. traits:
  14. - type: ingress
  15. properties:
  16. domain: testsvc.example.com
  17. http:
  18. /: 8000
  19. workflow:
  20. steps:
  21. - name: express-server
  22. type: apply-component
  23. properties:
  24. component: express-server
  25. # cluster: <your cluster name>
  26. # namespace: <your namespace name>
名称描述类型是否必须默认值
componentSpecify the component name to apply。stringtrue
clusterSpecify the cluster。stringfalseempty
namespaceSpecify the namespace。stringfalseempty

Apply deployment with specified image and cmd。

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

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: apply-deploy
  5. namespace: default
  6. spec:
  7. components:
  8. - name: express-server
  9. type: webservice
  10. properties:
  11. image: oamdev/hello-world
  12. port: 8000
  13. workflow:
  14. steps:
  15. - name: apply-comp
  16. type: apply-component
  17. properties:
  18. component: express-server
  19. - name: apply-deploy
  20. type: apply-deployment
  21. properties:
  22. image: nginx
名称描述类型是否必须默认值
imagestringtrue
replicasintfalse1
clusterstringfalseempty
cmd[]stringfalse

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

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

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: server-with-pvc
  5. namespace: default
  6. spec:
  7. components:
  8. - name: express-server
  9. type: webservice
  10. properties:
  11. image: oamdev/hello-world
  12. port: 8000
  13. volumes:
  14. - name: "my-pvc"
  15. type: "pvc"
  16. mountPath: "/test"
  17. claimName: "myclaim"
  18. workflow:
  19. steps:
  20. - name: apply-pvc
  21. type: apply-object
  22. properties:
  23. # Kubernetes native resources fields
  24. value:
  25. apiVersion: v1
  26. kind: PersistentVolumeClaim
  27. metadata:
  28. name: myclaim
  29. namespace: default
  30. spec:
  31. accessModes:
  32. - ReadWriteOnce
  33. resources:
  34. requests:
  35. storage: 8Gi
  36. storageClassName: standard
  37. # the cluster you want to apply the resource to, default is the current cluster
  38. cluster: <your cluster name>
  39. - name: apply-server
  40. type: apply-component
  41. properties:
  42. component: express-serve
名称描述类型是否必须默认值
valueKubernetes 资源对象参数。map[string]_true
cluster需要部署的集群名称。如果不指定,则为当前集群。stringfalseempty

Apply terraform configuration in the step。

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

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: apply-terraform-resource
  5. namespace: default
  6. spec:
  7. components: []
  8. workflow:
  9. steps:
  10. - name: provider
  11. type: apply-terraform-provider
  12. properties:
  13. type: alibaba
  14. name: my-alibaba-provider
  15. accessKey: <accessKey>
  16. secretKey: <secretKey>
  17. region: cn-hangzhou
  18. - name: configuration
  19. type: apply-terraform-config
  20. properties:
  21. source:
  22. path: alibaba/cs/dedicated-kubernetes
  23. remote: https://github.com/FogDong/terraform-modules
  24. providerRef:
  25. name: my-alibaba-provider
  26. writeConnectionSecretToRef:
  27. name: my-terraform-secret
  28. namespace: vela-system
  29. variable:
  30. name: regular-check-ack
  31. new_nat_gateway: true
  32. vpc_name: "tf-k8s-vpc-regular-check"
  33. vpc_cidr: "10.0.0.0/8"
  34. vswitch_name_prefix: "tf-k8s-vsw-regualr-check"
  35. vswitch_cidrs: [ "10.1.0.0/16", "10.2.0.0/16", "10.3.0.0/16" ]
  36. k8s_name_prefix: "tf-k8s-regular-check"
  37. k8s_version: 1.24.6-aliyun.1
  38. k8s_pod_cidr: "192.168.5.0/24"
  39. k8s_service_cidr: "192.168.2.0/24"
  40. k8s_worker_number: 2
  41. cpu_core_count: 4
  42. memory_size: 8
  43. tags:
  44. created_by: "Terraform-of-KubeVela"
  45. created_from: "module-tf-alicloud-ecs-instance"
名称描述类型是否必须默认值
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
名称描述类型是否必须默认值
hcldirectly specify the hcl of the terraform configuration。stringtrue
名称描述类型是否必须默认值
remotespecify the remote url of the terraform configuration。stringfalsehttps://github.com/kubevela-contrib/terraform-modules.git
pathspecify the path of the terraform configuration。stringfalse
名称描述类型是否必须默认值
namestringtrue
namespace|true
名称描述类型是否必须默认值
namestringtrue
namespace|true

Apply terraform provider config。

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

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: apply-terraform-provider
  5. namespace: default
  6. spec:
  7. components: []
  8. workflow:
  9. steps:
  10. - name: provider
  11. type: apply-terraform-provider
  12. properties:
  13. type: alibaba
  14. name: my-alibaba-provider
  15. accessKey: <accessKey>
  16. secretKey: <secretKey>
  17. region: cn-hangzhou
名称描述类型是否必须默认值
AlibabaProvider or AWSProvider or AzureProvider or BaiduProvider or ECProvider or GCPProvider or TencentProvider or UCloudProviderfalse
名称描述类型是否必须默认值
typestringtrue
accessKeystringtrue
secretKeystringtrue
namestringfalsealibaba-provider
regionstringtrue
名称描述类型是否必须默认值
tokenstringfalseempty
typestringtrue
accessKeystringtrue
secretKeystringtrue
namestringfalseaws-provider
regionstringtrue
名称描述类型是否必须默认值
subscriptionIDstringtrue
tenantIDstringtrue
clientIDstringtrue
clientSecretstringtrue
namestringfalseazure-provider
名称描述类型是否必须默认值
typestringtrue
accessKeystringtrue
secretKeystringtrue
namestringfalsebaidu-provider
regionstringtrue
名称描述类型是否必须默认值
typestringtrue
apiKeystringfalseempty
namestringfalseec-provider
名称描述类型是否必须默认值
credentialsstringtrue
regionstringtrue
projectstringtrue
typestringtrue
namestringfalsegcp-provider
名称描述类型是否必须默认值
secretIDstringtrue
secretKeystringtrue
regionstringtrue
typestringtrue
namestringfalsetencent-provider
名称描述类型是否必须默认值
publicKeystringtrue
privateKeystringtrue
projectIDstringtrue
regionstringtrue
typestringtrue
namestringfalseucloud-provider

Build and push image from git url。

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

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: build-push-image
  5. namespace: default
  6. spec:
  7. components:
  8. - name: my-web
  9. type: webservice
  10. properties:
  11. image: fogdong/simple-web-demo:v1
  12. ports:
  13. - port: 80
  14. expose: true
  15. workflow:
  16. steps:
  17. - name: create-git-secret
  18. type: export2secret
  19. properties:
  20. secretName: git-secret
  21. data:
  22. token: <git token>
  23. - name: create-image-secret
  24. type: export2secret
  25. properties:
  26. secretName: image-secret
  27. kind: docker-registry
  28. dockerRegistry:
  29. username: <docker username>
  30. password: <docker password>
  31. - name: build-push
  32. type: build-push-image
  33. properties:
  34. # use your kaniko executor image like below, if not set, it will use default image oamdev/kaniko-executor:v1.9.1
  35. # kanikoExecutor: gcr.io/kaniko-project/executor:latest
  36. # you can use context with git and branch or directly specify the context, please refer to https://github.com/GoogleContainerTools/kaniko#kaniko-build-contexts
  37. context:
  38. git: github.com/FogDong/simple-web-demo
  39. branch: main
  40. image: fogdong/simple-web-demo:v1
  41. # specify your dockerfile, if not set, it will use default dockerfile ./Dockerfile
  42. # dockerfile: ./Dockerfile
  43. credentials:
  44. image:
  45. name: image-secret
  46. # buildArgs:
  47. # - key="value"
  48. # platform: linux/arm
  49. - name: apply-comp
  50. type: apply-component
  51. properties:
  52. component: my-web
名称描述类型是否必须默认值
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
名称描述类型是否必须默认值
gitSpecify the credentials to access git。gitfalse
imageSpecify the credentials to access image registry。imagefalse
名称描述类型是否必须默认值
nameSpecify the secret name。stringtrue
keySpecify the secret key。stringtrue
名称描述类型是否必须默认值
nameSpecify the secret name。stringtrue
keySpecify the secret key。stringfalse.dockerconfigjson

Send request to chat-gpt。

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

  1. apiVersion: core.oam.dev/v1alpha1
  2. kind: WorkflowRun
  3. metadata:
  4. name: chat-gpt
  5. namespace: default
  6. spec:
  7. workflowSpec:
  8. steps:
  9. # apply a deployment with invalid image, this step will fail because of timeout
  10. # the resource will be passed to chat-gpt step to anaylze
  11. - name: apply
  12. type: apply-deployment
  13. timeout: 3s
  14. outputs:
  15. - name: resource
  16. valueFrom: output.value
  17. properties:
  18. image: invalid
  19. # if apply step failed, send the resource to chat-gpt to diagnose
  20. - name: chat-diagnose
  21. if: status.apply.failed
  22. type: chat-gpt
  23. inputs:
  24. - from: resource
  25. parameterKey: prompt.content
  26. properties:
  27. token:
  28. # specify your token
  29. value: <your token>
  30. prompt:
  31. type: diagnose
  32. # if apply step succeeded, send the resource to chat-gpt to audit
  33. - name: chat-audit
  34. if: status.apply.succeeded
  35. type: chat-gpt
  36. inputs:
  37. - from: resource
  38. parameterKey: prompt.content
  39. properties:
  40. token:
  41. # or read your token from secret
  42. secretRef:
  43. name: chat-gpt-token-secret
  44. key: token
  45. prompt:
  46. type: audit
  47. lang: Chinese
名称描述类型是否必须默认值
tokentype-option-1 or type-option-2true
modelthe model name。stringfalsegpt-3.5-turbo
promptthe prompt to use。prompttrue
timeoutstringfalse30s
名称描述类型是否必须默认值
valuethe token value。stringtrue
名称描述类型是否必须默认值
secretRefsecretReftrue
名称描述类型是否必须默认值
nameKubernetes Secret 名称。stringtrue
keykey is the token key in the secret。stringtrue
名称描述类型是否必须默认值
type“custom” or “diagnose” or “audit” or “quality-gate”falsecustom
lang“English” or “Chinese”falseEnglish
contentstringtrue

Verify application’s metrics。

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

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: canary-demo
  5. annotations:
  6. app.oam.dev/publishVersion: v2
  7. spec:
  8. components:
  9. - name: canary-demo
  10. type: webservice
  11. properties:
  12. image: wangyikewyk/canarydemo:v2
  13. ports:
  14. - port: 8090
  15. traits:
  16. - type: scaler
  17. properties:
  18. replicas: 5
  19. - type: gateway
  20. properties:
  21. domain: canary-demo.com
  22. http:
  23. "/version": 8090
  24. workflow:
  25. steps:
  26. - name: 200-status-percent-2-phase
  27. type: check-metrics
  28. timeout: 3m
  29. properties:
  30. 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]))
  31. promAddress: "http://prometheus-server.o11y-system.svc:9090"
  32. condition: ">=0.95"
  33. duration: 2m
名称描述类型是否必须默认值
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 applied jobs in the cluster。

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

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: clean-jobs
  5. namespace: default
  6. spec:
  7. components: []
  8. workflow:
  9. steps:
  10. - name: clean-cli-jobs
  11. type: clean-jobs
  12. properties:
  13. labelselector:
  14. "my-label": my-value
名称描述类型是否必须默认值
labelselectormap[string]_false
namespace|true

Collect service endpoints for the application。

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

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: app-collect-service-endpoint-and-export
  5. spec:
  6. components:
  7. - type: webservice
  8. name: busybox
  9. properties:
  10. image: busybox
  11. imagePullPolicy: IfNotPresent
  12. cmd:
  13. - sleep
  14. - '1000000'
  15. traits:
  16. - type: expose
  17. properties:
  18. port: [8080]
  19. type: ClusterIP
  20. policies:
  21. - type: topology
  22. name: local
  23. properties:
  24. clusters: ["local"]
  25. - type: topology
  26. name: all
  27. properties:
  28. clusters: ["local", "cluster-worker"]
  29. workflow:
  30. steps:
  31. - type: deploy
  32. name: deploy
  33. properties:
  34. policies: ["local"]
  35. - type: collect-service-endpoints
  36. name: collect-service-endpoints
  37. outputs:
  38. - name: host
  39. valueFrom: value.endpoint.host
  40. - type: export-data
  41. name: export-data
  42. properties:
  43. topology: all
  44. inputs:
  45. - from: host
  46. parameterKey: data.host

This capability has no arguments.

Create or update a config。

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

  1. kind: Application
  2. apiVersion: core.oam.dev/v1beta1
  3. metadata:
  4. name: test-config
  5. namespace: "config-e2e-test"
  6. spec:
  7. components: []
  8. workflow:
  9. steps:
  10. - name: write-config
  11. type: create-config
  12. properties:
  13. name: test
  14. config:
  15. key1: value1
  16. key2: 2
  17. key3: true
  18. key4:
  19. key5: value5
  20. - name: read-config
  21. type: read-config
  22. properties:
  23. name: test
  24. outputs:
  25. - fromKey: config
  26. name: read-config
  27. - name: delete-config
  28. type: delete-config
  29. properties:
  30. name: test
名称描述类型是否必须默认值
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 a config。

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

  1. kind: Application
  2. apiVersion: core.oam.dev/v1beta1
  3. metadata:
  4. name: test-config
  5. namespace: "config-e2e-test"
  6. spec:
  7. components: []
  8. workflow:
  9. steps:
  10. - name: write-config
  11. type: create-config
  12. properties:
  13. name: test
  14. config:
  15. key1: value1
  16. key2: 2
  17. key3: true
  18. key4:
  19. key5: value5
  20. - name: delete-config
  21. type: delete-config
  22. properties:
  23. name: test
名称描述类型是否必须默认值
nameSpecify the name of the config。stringtrue
namespaceSpecify the namespace of the config。stringfalse

等待指定的 Application 完成。

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

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: first-vela-workflow
  5. namespace: default
  6. spec:
  7. components:
  8. - name: express-server
  9. type: webservice
  10. properties:
  11. image: oamdev/hello-world
  12. port: 8000
  13. traits:
  14. - type: ingress
  15. properties:
  16. domain: testsvc.example.com
  17. http:
  18. /: 8000
  19. workflow:
  20. steps:
  21. - name: express-server
  22. type: depends-on-app
  23. properties:
  24. name: another-app
  25. 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.

  1. apiVersion: v1
  2. kind: ConfigMap
  3. metadata:
  4. name: myapp
  5. namespace: vela-system
  6. data:
  7. application:
  8. <app yaml file>
名称描述类型是否必须默认值
name需要等待的 Application 名称。stringtrue
namespace需要等待的 Application 所在的命名空间。stringtrue

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

该步骤类型只适用于 Application。

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: deploy-workflowstep
  5. namespace: examples
  6. spec:
  7. components:
  8. - name: nginx-deploy-workflowstep
  9. type: webservice
  10. properties:
  11. image: nginx
  12. policies:
  13. - name: topology-hangzhou-clusters
  14. type: topology
  15. properties:
  16. clusterLabelSelector:
  17. region: hangzhou
  18. - name: topology-local
  19. type: topology
  20. properties:
  21. clusters: ["local"]
  22. namespace: examples-alternative
  23. workflow:
  24. steps:
  25. - type: deploy
  26. name: deploy-local
  27. properties:
  28. policies: ["topology-local"]
  29. - type: deploy
  30. name: deploy-hangzhou
  31. properties:
  32. # require manual approval before running this step
  33. auto: false
  34. policies: ["topology-hangzhou-clusters"]
名称描述类型是否必须默认值
auto默认为 true。如果为 false,工作流将在执行该步骤前自动暂停。。boolfalsetrue
policies指定本次部署要使用的策略。如果不指定策略,将自动部署到管控集群。[]stringtrue
parallelism指定本次部署的并发度。intfalse5
ignoreTerraformComponent部署时忽略 Terraform 的组件,默认忽略,Terraform 仅需要在管控集群操作云资源,不需要管控信息下发到多集群。boolfalsetrue

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

该步骤类型只适用于 Application。

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: rds-app
  5. namespace: project-1
  6. spec:
  7. components:
  8. - name: db
  9. type: alibaba-rds
  10. properties:
  11. instance_name: db
  12. account_name: kubevela
  13. password: my-password
  14. writeConnectionSecretToRef:
  15. name: project-1-rds-conn-credential
  16. policies:
  17. - name: env-policy
  18. type: env-binding
  19. properties:
  20. envs:
  21. # 部署 RDS 给杭州集群
  22. - name: hangzhou
  23. placement:
  24. clusterSelector:
  25. name: cluster-hangzhou
  26. patch:
  27. components:
  28. - name: db
  29. type: alibaba-rds
  30. properties:
  31. # region: hangzhou
  32. instance_name: hangzhou_db
  33. # 部署 RDS 给香港集群
  34. - name: hongkong
  35. placement:
  36. clusterSelector:
  37. name: cluster-hongkong
  38. namespaceSelector:
  39. name: hk-project-1
  40. patch:
  41. components:
  42. - name: db
  43. type: alibaba-rds
  44. properties:
  45. # region: hongkong
  46. instance_name: hongkong_db
  47. writeConnectionSecretToRef:
  48. name: hk-project-rds-credential
  49. workflow:
  50. steps:
  51. # 部署 RDS 给杭州区用
  52. - name: deploy-hangzhou-rds
  53. type: deploy-cloud-resource
  54. properties:
  55. env: hangzhou
  56. # 将给杭州区用的 RDS 共享给北京区
  57. - name: share-hangzhou-rds-to-beijing
  58. type: share-cloud-resource
  59. properties:
  60. env: hangzhou
  61. placements:
  62. - cluster: cluster-beijing
  63. # 部署 RDS 给香港区用
  64. - name: deploy-hongkong-rds
  65. type: deploy-cloud-resource
  66. properties:
  67. env: hongkong
  68. # 将给香港区用的 RDS 共享给香港区其他项目用
  69. - name: share-hongkong-rds-to-other-namespace
  70. type: share-cloud-resource
  71. properties:
  72. env: hongkong
  73. placements:
  74. - cluster: cluster-hongkong
  75. namespace: hk-project-2
  76. - cluster: cluster-hongkong
  77. namespace: hk-project-3
名称描述类型是否必须默认值
policyDeclare the name of the env-binding policy, if empty, the first env-binding policy will be used。stringfalseempty
env指定多集群策略中定义的环境名称。stringtrue

Export data to clusters specified by topology。

该步骤类型只适用于 Application。

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: app-collect-service-endpoint-and-export
  5. spec:
  6. components:
  7. - type: webservice
  8. name: busybox
  9. properties:
  10. image: busybox
  11. imagePullPolicy: IfNotPresent
  12. cmd:
  13. - sleep
  14. - '1000000'
  15. traits:
  16. - type: expose
  17. properties:
  18. port: [8080]
  19. type: ClusterIP
  20. policies:
  21. - type: topology
  22. name: local
  23. properties:
  24. clusters: ["local"]
  25. - type: topology
  26. name: all
  27. properties:
  28. clusters: ["local", "cluster-worker"]
  29. workflow:
  30. steps:
  31. - type: deploy
  32. name: deploy
  33. properties:
  34. policies: ["local"]
  35. - type: collect-service-endpoints
  36. name: collect-service-endpoints
  37. outputs:
  38. - name: host
  39. valueFrom: value.endpoint.host
  40. - type: export-data
  41. name: export-data
  42. properties:
  43. topology: all
  44. inputs:
  45. - from: host
  46. parameterKey: data.host
名称描述类型是否必须默认值
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 to clusters specified by topology。

该步骤类型只适用于 Application。

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: app-collect-service-endpoint-and-export
  5. spec:
  6. components:
  7. - type: webservice
  8. name: busybox
  9. properties:
  10. image: busybox
  11. imagePullPolicy: IfNotPresent
  12. cmd:
  13. - sleep
  14. - '1000000'
  15. traits:
  16. - type: expose
  17. properties:
  18. port: [8080]
  19. type: LoadBalancer
  20. policies:
  21. - type: topology
  22. name: local
  23. properties:
  24. clusters: ["local"]
  25. - type: topology
  26. name: worker
  27. properties:
  28. clusters: ["cluster-worker"]
  29. workflow:
  30. steps:
  31. - type: deploy
  32. name: deploy
  33. properties:
  34. policies: ["local"]
  35. - type: collect-service-endpoints
  36. name: collect-service-endpoints
  37. outputs:
  38. - name: host
  39. valueFrom: value.endpoint.host
  40. - name: port
  41. valueFrom: value.endpoint.port
  42. - type: export-service
  43. name: export-service
  44. properties:
  45. name: busybox
  46. topology: worker
  47. inputs:
  48. - from: host
  49. parameterKey: ip
  50. - from: port
  51. parameterKey: port
名称描述类型是否必须默认值
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

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

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

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: export2config
  5. namespace: default
  6. spec:
  7. components:
  8. - name: export2config-demo-server
  9. type: webservice
  10. properties:
  11. image: oamdev/hello-world
  12. port: 8000
  13. workflow:
  14. steps:
  15. - name: apply-server
  16. type: apply-component
  17. outputs:
  18. - name: status
  19. valueFrom: output.status.conditions[0].message
  20. properties:
  21. component: export2config-demo-server
  22. - name: export-config
  23. type: export2config
  24. inputs:
  25. - from: status
  26. parameterKey: data.serverstatus
  27. properties:
  28. configName: my-configmap
  29. data:
  30. testkey: |
  31. testvalue
  32. value-line-2
名称描述类型是否必须默认值
configNameConfigMap 的名称。stringtrue
namespaceConfigMap 的 namespace,默认为当前应用的 namespace。stringfalse
data需要导出到 ConfigMap 中的数据,是一个 key-value 的 map。structtrue
cluster要导出到的集群名称。stringfalseempty

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

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

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: export-secret
  5. namespace: default
  6. spec:
  7. components:
  8. - name: express-server-sec
  9. type: webservice
  10. properties:
  11. image: oamdev/hello-world
  12. port: 8000
  13. workflow:
  14. steps:
  15. - name: apply-server
  16. type: apply-component
  17. outputs:
  18. - name: status
  19. valueFrom: output.status.conditions[0].message
  20. properties:
  21. component: express-server-sec
  22. - name: export-secret
  23. type: export2secret
  24. inputs:
  25. - from: status
  26. parameterKey: data.serverstatus
  27. properties:
  28. secretName: my-secret
  29. data:
  30. testkey: |
  31. testvalue
  32. value-line-2
名称描述类型是否必须默认值
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
名称描述类型是否必须默认值
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 a JDBC connection based on Component of alibaba-rds。

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

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: jdbc
  5. spec:
  6. components:
  7. - name: db
  8. type: alibaba-rds
  9. properties:
  10. instance_name: favorite-links
  11. database_name: db1
  12. account_name: oamtest
  13. password: U34rfwefwefffaked
  14. security_ips: [ "0.0.0.0/0" ]
  15. privilege: ReadWrite
  16. writeConnectionSecretToRef:
  17. name: db-conn
  18. - name: express-server
  19. type: webservice
  20. properties:
  21. image: crccheck/hello-world
  22. port: 8000
  23. workflow:
  24. steps:
  25. - name: jdbc
  26. type: generate-jdbc-connection
  27. outputs:
  28. - name: jdbc
  29. valueFrom: jdbc
  30. properties:
  31. name: db-conn
  32. namespace: default
  33. - name: apply
  34. type: apply-component
  35. inputs:
  36. - from: jdbc
  37. parameterKey: env
  38. properties:
  39. component: express-server
名称描述类型是否必须默认值
nameSpecify the name of the secret generated by database component。stringtrue
namespaceSpecify the namespace of the secret generated by database component。stringfalse

List the configs。

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

  1. apiVersion: core.oam.dev/v1alpha1
  2. kind: WorkflowRun
  3. metadata:
  4. name: observability
  5. namespace: vela-system
  6. spec:
  7. context:
  8. readConfig: true
  9. mode:
  10. workflowSpec:
  11. steps:
  12. - name: Enable Prism
  13. type: addon-operation
  14. properties:
  15. addonName: vela-prism
  16. - name: Enable o11y
  17. type: addon-operation
  18. properties:
  19. addonName: o11y-definitions
  20. operation: enable
  21. args:
  22. - --override-definitions
  23. - name: Prepare Prometheus
  24. type: step-group
  25. subSteps:
  26. - name: get-exist-prometheus
  27. type: list-config
  28. properties:
  29. template: prometheus-server
  30. outputs:
  31. - name: prometheus
  32. valueFrom: "output.configs"
  33. - name: prometheus-server
  34. inputs:
  35. - from: prometheus
  36. # TODO: Make it is not required
  37. parameterKey: configs
  38. if: "!context.readConfig || len(inputs.prometheus) == 0"
  39. type: addon-operation
  40. properties:
  41. addonName: prometheus-server
  42. operation: enable
  43. args:
  44. - memory=4096Mi
  45. - serviceType=LoadBalancer
名称描述类型是否必须默认值
templateSpecify the template of the config。stringtrue
namespaceSpecify the namespace of the config。stringfalse

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

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

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: first-vela-workflow
  5. namespace: default
  6. spec:
  7. components:
  8. - name: express-server
  9. type: webservice
  10. properties:
  11. image: oamdev/hello-world
  12. port: 8000
  13. traits:
  14. - type: ingress
  15. properties:
  16. domain: testsvc.example.com
  17. http:
  18. /: 8000
  19. workflow:
  20. steps:
  21. - name: dingtalk-message
  22. type: notification
  23. properties:
  24. dingding:
  25. # the DingTalk webhook address, please refer to: https://developers.dingtalk.com/document/robots/custom-robot-access
  26. url:
  27. value: <url>
  28. message:
  29. msgtype: text
  30. text:
  31. content: Workflow starting...
  32. - name: application
  33. type: apply-application
  34. - name: slack-message
  35. type: notification
  36. properties:
  37. slack:
  38. # the Slack webhook address, please refer to: https://api.slack.com/messaging/webhooks
  39. url:
  40. secretRef:
  41. name: <secret-key>
  42. key: <secret-value>
  43. message:
  44. text: Workflow ended.
  45. lark:
  46. url:
  47. value: <lark-url>
  48. message:
  49. msg_type: "text"
  50. content: "{\"text\":\" Hello KubeVela\"}"
  51. email:
  52. from:
  53. address: <sender-email-address>
  54. alias: <sender-alias>
  55. password:
  56. # secretRef:
  57. # name: <secret-name>
  58. # key: <secret-key>
  59. value: <sender-password>
  60. host: <email host like smtp.gmail.com>
  61. port: <email port, optional, default to 587>
  62. to:
  63. - kubevela1@gmail.com
  64. - kubevela2@gmail.com
  65. content:
  66. subject: test-subject
  67. 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发送飞书信息。larkfalse
dingding发送钉钉信息。dingdingfalse
slack发送 Slack 信息。slackfalse
email发送邮件通知。emailfalse
名称描述类型是否必须默认值
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
名称描述类型是否必须默认值
valuethe url address content in string。stringtrue
名称描述类型是否必须默认值
secretRefsecretReftrue
名称描述类型是否必须默认值
nameKubernetes Secret 名称。stringtrue
keyKubernetes Secret 中的 key。stringtrue
名称描述类型是否必须默认值
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
名称描述类型是否必须默认值
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
名称描述类型是否必须默认值
valuethe url address content in string。stringtrue
名称描述类型是否必须默认值
secretRefsecretReftrue
名称描述类型是否必须默认值
nameKubernetes Secret 名称。stringtrue
keyKubernetes Secret 中的 key。stringtrue
名称描述类型是否必须默认值
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
名称描述类型是否必须默认值
contentstringtrue
名称描述类型是否必须默认值
textstringfalse
titlestringfalse
messageUrlstringfalse
picUrlstringfalse
名称描述类型是否必须默认值
textstringtrue
titlestringtrue
名称描述类型是否必须默认值
atMobiles[]stringfalse
isAtAllboolfalse
名称描述类型是否必须默认值
textstringtrue
titlestringtrue
hideAvatarstringtrue
btnOrientationstringtrue
singleTitlestringtrue
singleURLstringtrue
btns[]btnsfalse
名称描述类型是否必须默认值
titlestringtrue
actionURLstringtrue
名称描述类型是否必须默认值
links[]linkstrue
名称描述类型是否必须默认值
textstringfalse
titlestringfalse
messageUrlstringfalse
picUrlstringfalse
名称描述类型是否必须默认值
urlSlack 的 Webhook 地址,可以选择直接在 value 填写或从 secretRef 中获取。type-option-1 or type-option-2true
messageSpecify the message that you want to sent, refer to slack messagingmessagetrue
名称描述类型是否必须默认值
valuethe url address content in string。stringtrue
名称描述类型是否必须默认值
secretRefsecretReftrue
名称描述类型是否必须默认值
nameKubernetes Secret 名称。stringtrue
keyKubernetes Secret 中的 key。stringtrue
名称描述类型是否必须默认值
textSpecify the message text for slack notification。stringtrue
blocks[]blocksfalse
attachmentsattachmentsfalse
thread_tsstringfalse
mrkdwnSpecify the message text format in markdown for slack notification。boolfalsetrue
名称描述类型是否必须默认值
typestringtrue
block_idstringfalse
elements[]elementsfalse
名称描述类型是否必须默认值
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
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
名称描述类型是否必须默认值
titletitletrue
texttexttrue
confirmconfirmtrue
denydenytrue
stylestringfalse
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
名称描述类型是否必须默认值
texttexttrue
valuestringtrue
descriptiondescriptionfalse
urlstringfalse
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
名称描述类型是否必须默认值
texttexttrue
valuestringtrue
descriptiondescriptionfalse
urlstringfalse
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
名称描述类型是否必须默认值
texttexttrue
valuestringtrue
descriptiondescriptionfalse
urlstringfalse
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
名称描述类型是否必须默认值
trigger_actions_on[]stringfalse
名称描述类型是否必须默认值
blocks[]blocksfalse
colorstringfalse
名称描述类型是否必须默认值
typestringtrue
block_idstringfalse
elements[]elementsfalse
名称描述类型是否必须默认值
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
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
名称描述类型是否必须默认值
titletitletrue
texttexttrue
confirmconfirmtrue
denydenytrue
stylestringfalse
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
名称描述类型是否必须默认值
texttexttrue
valuestringtrue
descriptiondescriptionfalse
urlstringfalse
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
名称描述类型是否必须默认值
texttexttrue
valuestringtrue
descriptiondescriptionfalse
urlstringfalse
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
名称描述类型是否必须默认值
texttexttrue
valuestringtrue
descriptiondescriptionfalse
urlstringfalse
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
名称描述类型是否必须默认值
typestringtrue
textstringtrue
emojiboolfalse
verbatimboolfalse
名称描述类型是否必须默认值
trigger_actions_on[]stringfalse
名称描述类型是否必须默认值
from指定邮件发送人信息。fromtrue
to指定收件人信息。[]stringtrue
content指定邮件内容。contenttrue
名称描述类型是否必须默认值
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
名称描述类型是否必须默认值
valuethe password content in string。stringtrue
名称描述类型是否必须默认值
secretRefsecretReftrue
名称描述类型是否必须默认值
nameKubernetes Secret 名称。stringtrue
keyKubernetes Secret 中的 key。stringtrue
名称描述类型是否必须默认值
subject指定邮件标题。stringtrue
body指定邮件正文内容。stringtrue

print message in workflow step status。

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

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: print-message-in-status
  5. namespace: default
  6. spec:
  7. components:
  8. - name: express-server
  9. type: webservice
  10. properties:
  11. image: oamdev/hello-world
  12. port: 8000
  13. workflow:
  14. steps:
  15. - name: express-server
  16. type: apply-component
  17. properties:
  18. component: express-server
  19. - name: message
  20. type: print-message-in-status
  21. properties:
  22. message: "All addons have been enabled successfully, you can use 'vela addon list' to check them."
名称描述类型是否必须默认值
messagestringtrue

Read application from the cluster。

该步骤类型只适用于 WorkflowRun。

  1. apiVersion: core.oam.dev/v1alpha1
  2. kind: WorkflowRun
  3. metadata:
  4. name: apply-applications
  5. namespace: default
  6. annotations:
  7. workflowrun.oam.dev/debug: "true"
  8. spec:
  9. workflowSpec:
  10. steps:
  11. - name: check-app-exist
  12. type: read-app
  13. properties:
  14. name: webservice-app
  15. - name: apply-app1
  16. type: apply-app
  17. if: status["check-app-exist"].message == "Application not found"
  18. properties:
  19. data:
  20. apiVersion: core.oam.dev/v1beta1
  21. kind: Application
  22. metadata:
  23. name: webservice-app
  24. spec:
  25. components:
  26. - name: express-server
  27. type: webservice
  28. properties:
  29. image: crccheck/hello-world
  30. ports:
  31. - port: 8000
  32. - name: suspend
  33. type: suspend
  34. timeout: 24h
  35. - name: apply-app2
  36. type: apply-app
  37. properties:
  38. ref:
  39. name: my-app
  40. key: application
  41. type: configMap
  42. ---
  43. apiVersion: v1
  44. kind: ConfigMap
  45. metadata:
  46. name: my-app
  47. namespace: default
  48. data:
  49. application: |
  50. apiVersion: core.oam.dev/v1beta1
  51. kind: Application
  52. metadata:
  53. name: webservice-app2
  54. spec:
  55. components:
  56. - name: express-server2
  57. type: webservice
  58. properties:
  59. image: crccheck/hello-world
  60. ports:
  61. - port: 8000
名称描述类型是否必须默认值
namestringtrue
namespace|true

Read a config。

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

  1. kind: Application
  2. apiVersion: core.oam.dev/v1beta1
  3. metadata:
  4. name: test-config
  5. namespace: "config-e2e-test"
  6. spec:
  7. components: []
  8. workflow:
  9. steps:
  10. - name: read-config
  11. type: read-config
  12. properties:
  13. name: test
  14. outputs:
  15. - fromKey: config
  16. name: read-config
名称描述类型是否必须默认值
nameSpecify the name of the config。stringtrue
namespaceSpecify the namespace of the config。stringfalse

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

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

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: read-object
  5. namespace: default
  6. spec:
  7. components:
  8. - name: express-server
  9. type: webservice
  10. properties:
  11. image: oamdev/hello-world
  12. port: 8000
  13. workflow:
  14. steps:
  15. - name: read-object
  16. type: read-object
  17. outputs:
  18. - name: cpu
  19. valueFrom: output.value.data["cpu"]
  20. - name: memory
  21. valueFrom: output.value.data["memory"]
  22. properties:
  23. apiVersion: v1
  24. kind: ConfigMap
  25. name: my-cm-name
  26. cluster: <your cluster name
  27. - name: apply
  28. type: apply-component
  29. inputs:
  30. - from: cpu
  31. parameterKey: cpu
  32. - from: memory
  33. parameterKey: memory
  34. properties:
  35. component: express-server
名称描述类型是否必须默认值
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

Send request to the url。

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

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: request-http
  5. namespace: default
  6. spec:
  7. components: []
  8. workflow:
  9. steps:
  10. - name: request
  11. type: request
  12. properties:
  13. url: https://api.github.com/repos/kubevela/workflow
  14. outputs:
  15. - name: stars
  16. valueFrom: |
  17. import "strconv"
  18. "Current star count: " + strconv.FormatInt(response["stargazers_count"], 10)
  19. - name: notification
  20. type: notification
  21. inputs:
  22. - from: stars
  23. parameterKey: slack.message.text
  24. properties:
  25. slack:
  26. url:
  27. value: <your slack url>
  28. - name: failed-notification
  29. type: notification
  30. if: status.request.failed
  31. properties:
  32. slack:
  33. url:
  34. value: <your slack url>
  35. message:
  36. text: "Failed to request github"
名称描述类型是否必须默认值
urlstringtrue
method“GET” or “POST” or “PUT” or “DELETE”falseGET
bodymap[string]_false
headermap[string]stringfalse

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

该步骤类型只适用于 Application。

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: rds-app
  5. namespace: project-1
  6. spec:
  7. components:
  8. - name: db
  9. type: alibaba-rds
  10. properties:
  11. instance_name: db
  12. account_name: kubevela
  13. password: my-password
  14. writeConnectionSecretToRef:
  15. name: project-1-rds-conn-credential
  16. policies:
  17. - name: env-policy
  18. type: env-binding
  19. properties:
  20. envs:
  21. # 部署 RDS 给杭州集群
  22. - name: hangzhou
  23. placement:
  24. clusterSelector:
  25. name: cluster-hangzhou
  26. patch:
  27. components:
  28. - name: db
  29. type: alibaba-rds
  30. properties:
  31. # region: hangzhou
  32. instance_name: hangzhou_db
  33. # 部署 RDS 给香港集群
  34. - name: hongkong
  35. placement:
  36. clusterSelector:
  37. name: cluster-hongkong
  38. namespaceSelector:
  39. name: hk-project-1
  40. patch:
  41. components:
  42. - name: db
  43. type: alibaba-rds
  44. properties:
  45. # region: hongkong
  46. instance_name: hongkong_db
  47. writeConnectionSecretToRef:
  48. name: hk-project-rds-credential
  49. workflow:
  50. steps:
  51. # 部署 RDS 给杭州区用
  52. - name: deploy-hangzhou-rds
  53. type: deploy-cloud-resource
  54. properties:
  55. env: hangzhou
  56. # 将给杭州区用的 RDS 共享给北京区
  57. - name: share-hangzhou-rds-to-beijing
  58. type: share-cloud-resource
  59. properties:
  60. env: hangzhou
  61. placements:
  62. - cluster: cluster-beijing
  63. # 部署 RDS 给香港区用
  64. - name: deploy-hongkong-rds
  65. type: deploy-cloud-resource
  66. properties:
  67. env: hongkong
  68. # 将给香港区用的 RDS 共享给香港区其他项目用
  69. - name: share-hongkong-rds-to-other-namespace
  70. type: share-cloud-resource
  71. properties:
  72. env: hongkong
  73. placements:
  74. - cluster: cluster-hongkong
  75. namespace: hk-project-2
  76. - cluster: cluster-hongkong
  77. namespace: hk-project-3
名称描述类型是否必须默认值
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
名称描述类型是否必须默认值
namespacestringfalse
clusterstringfalse

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。

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: example
  5. namespace: default
  6. spec:
  7. components:
  8. - name: express-server
  9. type: webservice
  10. properties:
  11. image: crccheck/hello-world
  12. port: 8000
  13. - name: express-server2
  14. type: webservice
  15. properties:
  16. image: crccheck/hello-world
  17. port: 8000
  18. workflow:
  19. steps:
  20. - name: step
  21. type: step-group
  22. subSteps:
  23. - name: apply-sub-step1
  24. type: apply-component
  25. properties:
  26. component: express-server
  27. - name: apply-sub-step2
  28. type: apply-component
  29. properties:
  30. component: express-server2

This capability has no arguments.

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

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

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

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: first-vela-workflow
  5. namespace: default
  6. spec:
  7. components:
  8. - name: express-server
  9. type: webservice
  10. properties:
  11. image: oamdev/hello-world
  12. port: 8000
  13. workflow:
  14. steps:
  15. - name: slack-message
  16. type: notification
  17. properties:
  18. slack:
  19. url:
  20. value: <your-slack-url>
  21. # the Slack webhook address, please refer to: https://api.slack.com/messaging/webhooks
  22. message:
  23. text: Ready to apply the application, ask the administrator to approve and resume the workflow.
  24. - name: manual-approval
  25. type: suspend
  26. # properties:
  27. # duration: "30s"
  28. - name: express-server
  29. type: apply-component
  30. properties:
  31. component: express-server
名称描述类型是否必须默认值
duration指定工作流暂停的时长,超过该时间后工作流将自动继续,如:”30s”, “1min”, “2m15s”。stringfalse
messageThe suspend message to show。stringfalse

Run a vela command。

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

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: vela-cli
  5. namespace: default
  6. spec:
  7. components: []
  8. workflow:
  9. steps:
  10. - name: list-app
  11. type: vela-cli
  12. properties:
  13. command:
  14. - vela
  15. - ls
名称描述类型是否必须默认值
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
名称描述类型是否必须默认值
secretMount Secret type storage。[]secretfalse
hostPathDeclare host path type storage。[]hostPathfalse
名称描述类型是否必须默认值
namestringtrue
mountPathstringtrue
subPathstringfalse
defaultModeintfalse420
secretNamestringtrue
items[]itemsfalse
名称描述类型是否必须默认值
keystringtrue
pathstringtrue
modeintfalse511
名称描述类型是否必须默认值
namestringtrue
pathstringtrue
mountPathstringtrue
type“Directory” or “DirectoryOrCreate” or “FileOrCreate” or “File” or “Socket” or “CharDevice” or “BlockDevice”falseDirectory

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。

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: first-vela-workflow
  5. namespace: default
  6. spec:
  7. components:
  8. - name: express-server
  9. type: webservice
  10. properties:
  11. image: oamdev/hello-world
  12. port: 8000
  13. workflow:
  14. steps:
  15. - name: express-server
  16. type: apply-application
  17. - name: webhook
  18. type: webhook
  19. properties:
  20. url:
  21. value: <your webhook url>
名称描述类型是否必须默认值
url需要发送的 Webhook URL,可以选择直接在 value 填写或从 secretRef 中获取。type-option-1 or type-option-2true
data需要发送的内容。map[string]_false
名称描述类型是否必须默认值
valuestringtrue
名称描述类型是否必须默认值
secretRefsecretReftrue
名称描述类型是否必须默认值
nameKubernetes Secret 名称。stringtrue
keyKubernetes Secret 中的 key。stringtrue

Last updated on 2023年8月4日 by Daniel Higuero