kubevela/docs/examples/multi-stage-component-apply
ZhongsJie 1e3759bb25
Feat: add feature docs and controller parameters for MultiStageComponentApply (#4873)
Signed-off-by: ZhongsJie <zhongsjie@gmail.com>

Signed-off-by: ZhongsJie <zhongsjie@gmail.com>
2022-10-25 14:51:26 +08:00
..
README.md Feat: add feature docs and controller parameters for MultiStageComponentApply (#4873) 2022-10-25 14:51:26 +08:00

README.md

MultiStageComponentApply

This example shows how to enable MultiStageComponentApply, the MultiStageComponentApply feature will be combined with the stage field in TraitDefinition to complete the multi-stage apply. Currently, the stage field in TraitDefinition is an optional parameter, which provides PreDispatch and PostDispatch.

How to use multi-stage

The future-gate is still in alpha stage, and it is recommended to use it only in short-term test clusters.

The MultiStageComponentApply is not enabled by default, you need some extra works to use it.

  1. Add an args --feature-gates=MultiStageComponentApply=ture in KubeVela controller's deployment like:
    spec:
      containers:
        - args:
            - --feature-gates=MultiStageComponentApply=true
          ...
  1. Sometime, you have multi-stage apply requirements inside the component, and it is the outputs resource defined in the trait. In this case, you can use the stage with the value PreDispatch or PostDispatch like:
  apiVersion: core.oam.dev/v1beta1
  kind: TraitDefinition
  metadata:
    annotations:
      definition.oam.dev/description: Add storages on K8s pod for your workload which follows the pod spec in path 'spec.template'.
    name: storage
    namespace: vela-system
  spec:
    appliesToWorkloads:
      - deployments.apps
      - statefulsets.apps
      - daemonsets.apps
      - jobs.batch
    podDisruptive: true
    stage: PreDispatch
    schematic:
      cue:
        template: |
          ...