apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: workflow-rollout-demo
  namespace: default
spec:
  components:
    - name: nginx-server
      externalRevision: nginx-server-v2
      type: webservice
      properties:
        image: nginx:1.21
        port: 80
      traits:
        - type: rollout
          properties:
            targetRevision: nginx-server-v1
            targetSize: 2
            rolloutBatches:
              - replicas: 1
              - replicas: 1

  workflow:
    steps:
      - name: dispatch-comp-rev-v1
        type: dispatch-comp-rev
        properties:
          compRev: nginx-server-v1
          cluster: cluster2

      - name: dispatch-comp-rev-v2
        type: dispatch-comp-rev
        properties:
          compRev: nginx-server-v2
          cluster: cluster2

      - name: dispatchRollout
        type: dispatch-traits
        properties:
          component: nginx-server
          cluster: cluster2