内置策略列表

本文档将按字典序展示所有内置策略的参数列表。

本文档由脚本自动生成,请勿手动修改,上次更新于 2022-07-24T21:01:20+08:00。

Apply-Once

描述

只交付部署资源,不保证终态一致、允许配置漂移。适用于与其他控制器协作的轻量级交付场景。

示例 (apply-once)

It’s generally used in one time delivery only without continuous management scenario.

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: apply-once-app
  5. spec:
  6. components:
  7. - name: hello-world
  8. type: webservice
  9. properties:
  10. image: oamdev/hello-world
  11. traits:
  12. - type: scaler
  13. properties:
  14. replicas: 1
  15. policies:
  16. - name: apply-once
  17. type: apply-once
  18. properties:
  19. enable: true

参数说明 (apply-once)

名称描述类型是否必须默认值
enable当设置为 true 时,表示只交付部署、不保证终态一致、允许配置漂移。boolfalsefalse
rules指定交付一次的资源规则。[]rulesfalse

rules (apply-once)

名称描述类型是否必须默认值
selector指定资源筛选目标规则。selectorfalse
strategySpecify the strategy for configuring the resource level configuration drift behaviour。strategytrue
selector (apply-once)
名称描述类型是否必须默认值
componentNames按组件名称选择目标资源。[]stringfalse
componentTypes按组件类型选择目标资源。[]stringfalse
oamTypes按 OAM 概念,组件(COMPONENT) 或 运维特征(TRAIT) 筛选。[]stringfalse
traitTypes按 trait 类型选择目标资源。[]stringfalse
resourceTypes按资源类型选择。[]stringfalse
resourceNames按资源名称选择。[]stringfalse
strategy (apply-once)
名称描述类型是否必须默认值
path指定资源的路径。[]stringtrue

Garbage-Collect

描述

为应用配置资源回收策略。 如配置资源不回收。

示例 (garbage-collect)

It’s used in garbage collection scenario. It can be used to configure the collection policy, e.g. don’t delete the legacy resources when updating.

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: first-vela-app
  5. spec:
  6. components:
  7. - name: express-server
  8. type: webservice
  9. properties:
  10. image: oamdev/hello-world
  11. port: 8000
  12. traits:
  13. - type: ingress-1-20
  14. properties:
  15. domain: testsvc.example.com
  16. http:
  17. "/": 8000
  18. policies:
  19. - name: keep-legacy-resource
  20. type: garbage-collect
  21. properties:
  22. keepLegacyResource: true
  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: garbage-collect-app
  5. spec:
  6. components:
  7. - name: hello-world-new
  8. type: webservice
  9. properties:
  10. image: oamdev/hello-world
  11. traits:
  12. - type: expose
  13. properties:
  14. port: [8000]
  15. policies:
  16. - name: garbage-collect
  17. type: garbage-collect
  18. properties:
  19. rules:
  20. - selector:
  21. traitTypes:
  22. - expose
  23. strategy: onAppDelete

参数说明 (garbage-collect)

名称描述类型是否必须默认值
keepLegacyResource如果为 true,过时的版本化 resource tracker 将不会自动回收。 过时的资源将被保留,直到手动删除 resource tracker。boolfalsefalse
rules在资源级别控制垃圾回收策略的规则列表,如果一个资源由多个规则控制,将使用第一个规则。[]rulesfalse

rules (garbage-collect)

名称描述类型是否必须默认值
selector指定资源筛选目标规则。[]selectortrue
strategy目标资源循环利用的策略。 可用值:never、onAppDelete、onAppUpdate。stringfalseonAppUpdate
selector (garbage-collect)
名称描述类型是否必须默认值
componentNames按组件名称选择目标资源。[]stringfalse
componentTypes按组件类型选择目标资源。[]stringfalse
oamTypes按 OAM 概念,组件(COMPONENT) 或 运维特征(TRAIT) 筛选。[]stringfalse
traitTypes按 trait 类型选择目标资源。[]stringfalse
resourceTypes按资源类型选择。[]stringfalse
resourceNames按资源名称选择。[]stringfalse

Health

描述

Apply periodical health checking to the application。

参数说明 (health)

名称描述类型是否必须默认值
probeTimeoutSpecify health checking timeout(seconds), default 10s。intfalse10
probeIntervalSpecify health checking interval(seconds), default 30s。intfalse30

Override

描述

描述部署资源时要覆盖的配置,需要配合工作流的 deploy 步骤一起使用才能生效。

示例 (override)

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: deploy-with-override
  5. namespace: examples
  6. spec:
  7. components:
  8. - name: nginx-with-override
  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. - name: override-nginx-legacy-image
  24. type: override
  25. properties:
  26. components:
  27. - name: nginx-with-override
  28. properties:
  29. image: nginx:1.20
  30. - name: override-high-availability
  31. type: override
  32. properties:
  33. components:
  34. - type: webservice
  35. traits:
  36. - type: scaler
  37. properties:
  38. replicas: 3
  39. workflow:
  40. steps:
  41. - type: deploy
  42. name: deploy-local
  43. properties:
  44. policies: ["topology-local"]
  45. - type: deploy
  46. name: deploy-hangzhou
  47. properties:
  48. policies: ["topology-hangzhou-clusters", "override-nginx-legacy-image", "override-high-availability"]
  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: advance-override
  5. namespace: examples
  6. spec:
  7. components:
  8. - name: nginx-advance-override-legacy
  9. type: webservice
  10. properties:
  11. image: nginx:1.20
  12. - name: nginx-advance-override-latest
  13. type: webservice
  14. properties:
  15. image: nginx
  16. policies:
  17. - name: topology-hangzhou-clusters
  18. type: topology
  19. properties:
  20. clusterLabelSelector:
  21. region: hangzhou
  22. - name: topology-local
  23. type: topology
  24. properties:
  25. clusters: ["local"]
  26. namespace: examples-alternative
  27. - name: override-nginx-legacy
  28. type: override
  29. properties:
  30. selector: ["nginx-advance-override-legacy"]
  31. - name: override-nginx-latest
  32. type: override
  33. properties:
  34. selector: ["nginx-advance-override-latest", "nginx-advance-override-stable"]
  35. components:
  36. - name: nginx-advance-override-stable
  37. type: webservice
  38. properties:
  39. image: nginx:stable
  40. workflow:
  41. steps:
  42. - type: deploy
  43. name: deploy-local
  44. properties:
  45. policies: ["topology-local", "override-nginx-legacy"]
  46. - type: deploy
  47. name: deploy-hangzhou
  48. properties:
  49. policies: ["topology-hangzhou-clusters", "override-nginx-latest"]

参数说明 (override)

名称描述类型是否必须默认值
components要覆盖的组件配置列表。[]componentstrue
selector要使用的组件名称列表。 如果未设置,将使用所有组件。[]stringfalse

components (override)

名称描述类型是否必须默认值
name要覆盖的组件的名称。 如果未设置,它将匹配具有指定类型的所有组件。 可以与通配符 * 一起使用以进行模糊匹配。。stringfalse
type要覆盖的组件的类型。 如果未设置,将匹配所有组件类型。stringfalse
properties要覆盖的配置属性,未填写配置会与原先的配置合并。map[string]:(null|bool|string|bytes|{…}|[…]|number)false
traits要覆盖的 trait 配置列表。[]traitsfalse
traits (override)
名称描述类型是否必须默认值
type要做参数覆盖的 trait 类型。stringtrue
properties要覆盖的配置属性,未填写配置会与原先的配置合并。map[string]:(null|bool|string|bytes|{…}|[…]|number)false
disable如果为 true,该 trait 将被删除,默认 false。boolfalsefalse

Topology

描述

描述组件应该部署到的集群环境。

示例 (topology)

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: basic-topology
  5. namespace: examples
  6. spec:
  7. components:
  8. - name: nginx-basic
  9. type: webservice
  10. properties:
  11. image: nginx
  12. policies:
  13. - name: topology-hangzhou-clusters
  14. type: topology
  15. properties:
  16. clusters: ["hangzhou-1", "hangzhou-2"]
  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: label-selector-topology
  5. namespace: examples
  6. spec:
  7. components:
  8. - name: nginx-label-selector
  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
  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: local-ns-topology
  5. namespace: examples
  6. spec:
  7. components:
  8. - name: nginx-local-ns
  9. type: webservice
  10. properties:
  11. image: nginx
  12. policies:
  13. - name: topology-local
  14. type: topology
  15. properties:
  16. clusters: ["local"]
  17. namespace: examples-alternative

参数说明 (topology)

名称描述类型是否必须默认值
cluster要选择的集群的名称。[]stringfalse
clusterLabelSelector根据集群标签选择。map[string]:stringfalse
clusterSelectorDeprecated: Use clusterLabelSelector instead。map[string]:stringfalse
namespace要在选定集群中部署的目标命名空间。 如果未设置,组件将继承原始命名空间。stringfalse