Skip to main content
Version: v1.5

Built-in Policy Type

This documentation will walk through all the built-in policy types sorted alphabetically.

It was generated automatically by scripts, please don't update manually, last updated at 2022-08-08T11:22:49+08:00.

Apply-Once

Description

Allow configuration drift for applied resources, delivery the resource without continuously reconciliation.

Examples (apply-once)

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

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: apply-once-app
spec:
components:
- name: hello-world
type: webservice
properties:
image: oamdev/hello-world
traits:
- type: scaler
properties:
replicas: 1
policies:
- name: apply-once
type: apply-once
properties:
enable: true

Specification (apply-once)

NameDescriptionTypeRequiredDefault
enableWhether to enable apply-once for the whole application.boolfalsefalse
rulesSpecify the rules for configuring apply-once policy in resource level.[]rulesfalse

rules (apply-once)

NameDescriptionTypeRequiredDefault
selectorSpecify how to select the targets of the rule.selectorfalse
strategySpecify the strategy for configuring the resource level configuration drift behaviour.strategytrue
selector (apply-once)
NameDescriptionTypeRequiredDefault
componentNamesSelect resources by component names.[]stringfalse
componentTypesSelect resources by component types.[]stringfalse
oamTypesSelect resources by oamTypes (COMPONENT or TRAIT).[]stringfalse
traitTypesSelect resources by trait types.[]stringfalse
resourceTypesSelect resources by resource types (like Deployment).[]stringfalse
resourceNamesSelect resources by their names.[]stringfalse
strategy (apply-once)
NameDescriptionTypeRequiredDefault
pathSpecify the path of the resource that allow configuration drift.[]stringtrue

Garbage-Collect

Description

Configure the garbage collect behaviour for the application.

Examples (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.

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: first-vela-app
spec:
components:
- name: express-server
type: webservice
properties:
image: oamdev/hello-world
port: 8000
traits:
- type: ingress-1-20
properties:
domain: testsvc.example.com
http:
"/": 8000
policies:
- name: keep-legacy-resource
type: garbage-collect
properties:
keepLegacyResource: true
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: garbage-collect-app
spec:
components:
- name: hello-world-new
type: webservice
properties:
image: oamdev/hello-world
traits:
- type: expose
properties:
port: [8000]
policies:
- name: garbage-collect
type: garbage-collect
properties:
rules:
- selector:
traitTypes:
- expose
strategy: onAppDelete

Specification (garbage-collect)

NameDescriptionTypeRequiredDefault
keepLegacyResourceIf is set, outdated versioned resourcetracker will not be recycled automatically, outdated resources will be kept until resourcetracker be deleted manually.boolfalsefalse
rulesSpecify the list of rules to control gc strategy at resource level, if one resource is controlled by multiple rules, first rule will be used.[]rulesfalse

rules (garbage-collect)

NameDescriptionTypeRequiredDefault
selectorSpecify how to select the targets of the rule.[]selectortrue
strategySpecify the strategy for target resource to recycle.stringfalseonAppUpdate
selector (garbage-collect)
NameDescriptionTypeRequiredDefault
componentNamesSelect resources by component names.[]stringfalse
componentTypesSelect resources by component types.[]stringfalse
oamTypesSelect resources by oamTypes (COMPONENT or TRAIT).[]stringfalse
traitTypesSelect resources by trait types.[]stringfalse
resourceTypesSelect resources by resource types (like Deployment).[]stringfalse
resourceNamesSelect resources by their names.[]stringfalse

Health

Description

Apply periodical health checking to the application.

Specification (health)

NameDescriptionTypeRequiredDefault
probeTimeoutSpecify health checking timeout(seconds), default 10s.intfalse10
probeIntervalSpecify health checking interval(seconds), default 30s.intfalse30

Override

Description

Describe the configuration to override when deploying resources, it only works with specified deploy step in workflow.

Examples (override)

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: deploy-with-override
namespace: examples
spec:
components:
- name: nginx-with-override
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
- name: override-nginx-legacy-image
type: override
properties:
components:
- name: nginx-with-override
properties:
image: nginx:1.20
- name: override-high-availability
type: override
properties:
components:
- type: webservice
traits:
- type: scaler
properties:
replicas: 3
workflow:
steps:
- type: deploy
name: deploy-local
properties:
policies: ["topology-local"]
- type: deploy
name: deploy-hangzhou
properties:
policies: ["topology-hangzhou-clusters", "override-nginx-legacy-image", "override-high-availability"]
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: advance-override
namespace: examples
spec:
components:
- name: nginx-advance-override-legacy
type: webservice
properties:
image: nginx:1.20
- name: nginx-advance-override-latest
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
- name: override-nginx-legacy
type: override
properties:
selector: ["nginx-advance-override-legacy"]
- name: override-nginx-latest
type: override
properties:
selector: ["nginx-advance-override-latest", "nginx-advance-override-stable"]
components:
- name: nginx-advance-override-stable
type: webservice
properties:
image: nginx:stable
workflow:
steps:
- type: deploy
name: deploy-local
properties:
policies: ["topology-local", "override-nginx-legacy"]
- type: deploy
name: deploy-hangzhou
properties:
policies: ["topology-hangzhou-clusters", "override-nginx-latest"]

Specification (override)

NameDescriptionTypeRequiredDefault
componentsSpecify the overridden component configuration.[]componentstrue
selectorSpecify a list of component names to use, if empty, all components will be selected.[]stringfalse

components (override)

NameDescriptionTypeRequiredDefault
nameSpecify the name of the patch component, if empty, all components will be merged.stringfalse
typeSpecify the type of the patch component.stringfalse
propertiesSpecify the properties to override.map[string]:(null|bool|string|bytes|{...}|[...]|number)false
traitsSpecify the traits to override.[]traitsfalse
traits (override)
NameDescriptionTypeRequiredDefault
typeSpecify the type of the trait to be patched.stringtrue
propertiesSpecify the properties to override.map[string]:(null|bool|string|bytes|{...}|[...]|number)false
disableSpecify if the trait should be remove, default false.boolfalsefalse

Shared-Resource

Description

Configure the resources to be sharable across applications.

Examples (shared-resource)

It's used in shared-resource scenario. It can be used to configure which resources can be shared between applications. The target resource will allow multiple application to read it but only the first one to be able to write it.

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: app1
spec:
components:
- name: ns1
type: k8s-objects
properties:
objects:
- apiVersion: v1
kind: Namespace
metadata:
name: example
- name: cm1
type: k8s-objects
properties:
objects:
- apiVersion: v1
kind: ConfigMap
metadata:
name: cm1
namespace: example
data:
key: value1
policies:
- name: shared-resource
type: shared-resource
properties:
rules:
- selector:
resourceTypes: ["Namespace"]
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: app2
spec:
components:
- name: ns2
type: k8s-objects
properties:
objects:
- apiVersion: v1
kind: Namespace
metadata:
name: example
- name: cm2
type: k8s-objects
properties:
objects:
- apiVersion: v1
kind: ConfigMap
metadata:
name: cm2
namespace: example
data:
key: value2
policies:
- name: shared-resource
type: shared-resource
properties:
rules:
- selector:
resourceTypes: ["Namespace"]

Specification (shared-resource)

NameDescriptionTypeRequiredDefault
rulesSpecify the list of rules to control shared-resource strategy at resource level.[]rulesfalse

rules (shared-resource)

NameDescriptionTypeRequiredDefault
selectorSpecify how to select the targets of the rule.[]selectortrue
selector (shared-resource)
NameDescriptionTypeRequiredDefault
componentNamesSelect resources by component names.[]stringfalse
componentTypesSelect resources by component types.[]stringfalse
oamTypesSelect resources by oamTypes (COMPONENT or TRAIT).[]stringfalse
traitTypesSelect resources by trait types.[]stringfalse
resourceTypesSelect resources by resource types (like Deployment).[]stringfalse
resourceNamesSelect resources by their names.[]stringfalse

Topology

Description

Describe the destination where components should be deployed to.

Examples (topology)

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: basic-topology
namespace: examples
spec:
components:
- name: nginx-basic
type: webservice
properties:
image: nginx
policies:
- name: topology-hangzhou-clusters
type: topology
properties:
clusters: ["hangzhou-1", "hangzhou-2"]
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: label-selector-topology
namespace: examples
spec:
components:
- name: nginx-label-selector
type: webservice
properties:
image: nginx
policies:
- name: topology-hangzhou-clusters
type: topology
properties:
clusterLabelSelector:
region: hangzhou
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: local-ns-topology
namespace: examples
spec:
components:
- name: nginx-local-ns
type: webservice
properties:
image: nginx
policies:
- name: topology-local
type: topology
properties:
clusters: ["local"]
namespace: examples-alternative

Specification (topology)

NameDescriptionTypeRequiredDefault
clusterSpecify the names of the clusters to select.[]stringfalse
clusterLabelSelectorSpecify the label selector for clusters.map[string]:stringfalse
clusterSelectorDeprecated: Use clusterLabelSelector instead.map[string]:stringfalse
namespaceSpecify the target namespace to deploy in the selected clusters, default inherit the original namespace.stringfalse