Fix(workflow): fix apply remaining doc in workflow (#179)
* Fix(workflow): fix apply remaining doc in workflow * add apply-component and suspend in remaining example
This commit is contained in:
parent
475e32e13d
commit
cf988c8121
|
|
@ -2,7 +2,7 @@
|
|||
title: Apply Remaining
|
||||
---
|
||||
|
||||
If we have applied some resources and do not want to specify the rest one by one, KubeVela provides the `apply-remaining` workflow step to filter out selected resources and apply remaining.
|
||||
If we want to apply one component first and then apply the rest of the components after the first one is running, KubeVela provides the `apply-remaining` workflow step to filter out selected resources and apply remaining.
|
||||
|
||||
In this guide, you will learn how to apply remaining resources via `apply-remaining` in `Workflow`.
|
||||
|
||||
|
|
@ -34,48 +34,73 @@ spec:
|
|||
properties:
|
||||
image: crccheck/hello-world
|
||||
port: 8000
|
||||
- name: express-server3
|
||||
type: webservice
|
||||
properties:
|
||||
image: crccheck/hello-world
|
||||
port: 8000
|
||||
- name: express-server4
|
||||
type: webservice
|
||||
properties:
|
||||
image: crccheck/hello-world
|
||||
port: 8000
|
||||
workflow:
|
||||
steps:
|
||||
- name: express-server
|
||||
- name: first-server
|
||||
type: apply-component
|
||||
properties:
|
||||
component: express-server
|
||||
- name: manual-approval
|
||||
# suspend is a built-in task of workflow used to suspend the workflow
|
||||
type: suspend
|
||||
- name: remaining-server
|
||||
# specify the workflow step type
|
||||
type: apply-remaining
|
||||
properties:
|
||||
# specify the component that needs to be skipped
|
||||
exceptions:
|
||||
# specify the configuration of the component
|
||||
express-server:
|
||||
# skipApplyWorkload indicates whether to skip apply the workload resource
|
||||
skipApplyWorkload: false
|
||||
# skipAllTraits indicates to skip apply all resources of the traits
|
||||
# if this is true, skipApplyTraits will be ignored
|
||||
skipAllTraits: false
|
||||
# skipApplyTraits specifies the names of the traits to skip apply
|
||||
skipApplyTraits:
|
||||
- ingress
|
||||
- name: express-server2
|
||||
type: apply-remaining
|
||||
properties:
|
||||
exceptions:
|
||||
express-server:
|
||||
skipApplyWorkload: true
|
||||
# skipAllTraits indicates to skip apply all resources of the traits
|
||||
skipAllTraits: true
|
||||
```
|
||||
|
||||
## Expected outcome
|
||||
|
||||
Check the component status in cluster:
|
||||
Check the component status in cluster and resume the workflow after the component is running:
|
||||
|
||||
```shell
|
||||
$ kubectl get deployment
|
||||
|
||||
NAME READY UP-TO-DATE AVAILABLE AGE
|
||||
express-server 1/1 1 1 3m28s
|
||||
express-server 0/1 1 0 5s
|
||||
|
||||
$ kubectl get ingress
|
||||
|
||||
No resources found in default namespace.
|
||||
NAME CLASS HOSTS ADDRESS PORTS AGE
|
||||
express-server <none> testsvc.example.com 80 47s
|
||||
```
|
||||
|
||||
We can see that the first component `express-server` has been applied to the cluster, but the trait named ingress has been skipped.
|
||||
Resume the workflow:
|
||||
|
||||
But the second component `express-server2` hasn't been applied to cluster since it has been skipped.
|
||||
```
|
||||
vela workflow resume first-vela-workflow
|
||||
```
|
||||
|
||||
Recheck the component status:
|
||||
|
||||
```shell
|
||||
$ kubectl get deployment
|
||||
|
||||
NAME READY UP-TO-DATE AVAILABLE AGE
|
||||
express-server 1/1 1 1 110s
|
||||
express-server2 1/1 1 1 6s
|
||||
express-server3 1/1 1 1 6s
|
||||
express-server4 1/1 1 1 6s
|
||||
```
|
||||
|
||||
We can see that all of the components has been applied to the cluster successfully. Besides, the first component `express-server` is not applied repeatedly.
|
||||
|
||||
With `apply-remaining`, we can easily filter and apply resources by filling in the built-in parameters.
|
||||
|
|
|
|||
|
|
@ -186,7 +186,6 @@ Create or update the resources corresponding to all components in the applicatio
|
|||
- exceptions: indicates the name of the exceptional component.
|
||||
- skipApplyWorkload: indicates whether to skip apply the workload resource.
|
||||
- skipAllTraits: indicates to skip apply all resources of the traits.
|
||||
- skipApplyTraits: specifies the names of the traits to skip apply.
|
||||
|
||||
|
||||
```
|
||||
|
|
@ -194,10 +193,7 @@ Create or update the resources corresponding to all components in the applicatio
|
|||
exceptions?: [componentName=string]: {
|
||||
skipApplyWorkload: *true | bool
|
||||
|
||||
// If this is true, skipApplyTraits will be ignored
|
||||
skipAllTraits: *true| bool
|
||||
|
||||
skipApplyTraits: [...string]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
title: 部署剩余资源
|
||||
---
|
||||
|
||||
在一些情况下,我们并不需要部署所有的资源,但跳过不想部署的,再一个个指定部署又太过繁琐。KubeVela 提供了一个 `apply-remaining` 类型的工作流步骤,可以使用户方便的一键过滤不想要的资源,并部署剩余组件。
|
||||
在一些情况下,我们希望先部署一个组件,等待其成功运行后,再一键部署剩余组件。KubeVela 提供了一个 `apply-remaining` 类型的工作流步骤,可以使用户方便的一键过滤不想要的资源,并部署剩余组件。
|
||||
本节将介绍如何在工作流中通过 `apply-remaining` 部署剩余资源。
|
||||
|
||||
## 如何使用
|
||||
|
|
@ -33,48 +33,73 @@ spec:
|
|||
properties:
|
||||
image: crccheck/hello-world
|
||||
port: 8000
|
||||
- name: express-server3
|
||||
type: webservice
|
||||
properties:
|
||||
image: crccheck/hello-world
|
||||
port: 8000
|
||||
- name: express-server4
|
||||
type: webservice
|
||||
properties:
|
||||
image: crccheck/hello-world
|
||||
port: 8000
|
||||
workflow:
|
||||
steps:
|
||||
- name: express-server
|
||||
- name: first-server
|
||||
type: apply-component
|
||||
properties:
|
||||
component: express-server
|
||||
- name: manual-approval
|
||||
# 工作流内置 suspend 类型的任务,用于暂停工作流
|
||||
type: suspend
|
||||
- name: remaining-server
|
||||
# 指定步骤类型
|
||||
type: apply-remaining
|
||||
properties:
|
||||
# 指定需要被跳过的组件
|
||||
exceptions:
|
||||
# 配置组件参数
|
||||
express-server:
|
||||
# skipApplyWorkload 表明是否需要跳过组件的部署
|
||||
skipApplyWorkload: false
|
||||
# skipAllTraits 表明是否需要跳过所有运维特征的部署
|
||||
# 如果这个参数值为 True,将会忽略 skipApplyTraits
|
||||
skipAllTraits: false
|
||||
# skipApplyTraits 指定了需要跳过部署的运维特征
|
||||
skipApplyTraits:
|
||||
- ingress
|
||||
- name: express-server2
|
||||
type: apply-remaining
|
||||
properties:
|
||||
exceptions:
|
||||
express-server:
|
||||
skipApplyWorkload: true
|
||||
# skipAllTraits 表明是否需要跳过所有运维特征的部署
|
||||
skipAllTraits: true
|
||||
```
|
||||
|
||||
## 期望结果
|
||||
|
||||
查看集群中组件的状态:
|
||||
查看集群中组件的状态,当组件运行成功后,再继续工作流:
|
||||
|
||||
```shell
|
||||
$ kubectl get deployment
|
||||
|
||||
NAME READY UP-TO-DATE AVAILABLE AGE
|
||||
express-server 1/1 1 1 3m28s
|
||||
express-server 0/1 1 0 5s
|
||||
|
||||
$ kubectl get ingress
|
||||
|
||||
No resources found in default namespace.
|
||||
NAME CLASS HOSTS ADDRESS PORTS AGE
|
||||
express-server <none> testsvc.example.com 80 47s
|
||||
```
|
||||
|
||||
可以看到,第一个组件 `express-server` 已经被部署到了集群中,但是 `ingress` 的运维特征并没有部署。
|
||||
继续该工作流:
|
||||
|
||||
而第二个组件 `express-server2` 被跳过了部署,没有部署到集群中。
|
||||
```
|
||||
vela workflow resume first-vela-workflow
|
||||
```
|
||||
|
||||
重新查看集群中组件的状态:
|
||||
|
||||
```shell
|
||||
$ kubectl get deployment
|
||||
|
||||
NAME READY UP-TO-DATE AVAILABLE AGE
|
||||
express-server 1/1 1 1 110s
|
||||
express-server2 1/1 1 1 6s
|
||||
express-server3 1/1 1 1 6s
|
||||
express-server4 1/1 1 1 6s
|
||||
```
|
||||
|
||||
可以看到,所有的组件都被部署到了集群中,且没有被重复部署。
|
||||
|
||||
通过填写 `apply-remaining` 中提供的参数,可以使用户方便的过滤部署资源。
|
||||
|
|
@ -185,7 +185,6 @@ apply: op.#ApplyComponent & {
|
|||
- exceptions: 指明该操作需要排除掉的组件。
|
||||
- skipApplyWorkload: 是否跳过该组件 workload 资源的同步。
|
||||
- skipAllTraits: 是否跳过该组件所有辅助资源的同步。
|
||||
- skipApplyTraits: 数组类型,包含需要跳过的该组件中辅助资源对应的名称(定义中 outputs 涉及的到名字)。
|
||||
|
||||
|
||||
```
|
||||
|
|
@ -195,11 +194,7 @@ apply: op.#ApplyComponent & {
|
|||
skipApplyWorkload: *true | bool
|
||||
|
||||
// skipAllTraits 表明是否需要跳过所有运维特征的部署
|
||||
// 如果这个参数值为 True,将会忽略 skipApplyTraits
|
||||
skipAllTraits: *true| bool
|
||||
|
||||
// skipApplyTraits 指定了需要跳过部署的运维特征
|
||||
skipApplyTraits: [...string]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
|
|||
Loading…
Reference in New Issue