github.com/oam-dev/kubevela@v1.9.11/docs/examples/multi-stage-component-apply/README.md (about)

     1  # MultiStageComponentApply
     2  
     3  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`.
     4  
     5  ## How to use multi-stage
     6  > The future-gate is still in alpha stage, and it is recommended to use it only in short-term test clusters.
     7  
     8  The `MultiStageComponentApply` is not enabled by default, you need some extra works to use it. 
     9  
    10  1. Add an args `--feature-gates=MultiStageComponentApply=ture` in KubeVela controller's deployment like:
    11  
    12  ```yaml
    13      spec:
    14        containers:
    15          - args:
    16              - --feature-gates=MultiStageComponentApply=true
    17            ...
    18  ```
    19  
    20  2. 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:
    21  
    22  ```yaml
    23    apiVersion: core.oam.dev/v1beta1
    24    kind: TraitDefinition
    25    metadata:
    26      annotations:
    27        definition.oam.dev/description: Add storages on K8s pod for your workload which follows the pod spec in path 'spec.template'.
    28      name: storage
    29      namespace: vela-system
    30    spec:
    31      appliesToWorkloads:
    32        - deployments.apps
    33        - statefulsets.apps
    34        - daemonsets.apps
    35        - jobs.batch
    36      podDisruptive: true
    37      stage: PreDispatch
    38      schematic:
    39        cue:
    40          template: |
    41            ...
    42  ```
    43