github.com/kubevela/workflow@v0.6.0/controllers/testdata/suspend-and-deploy.yaml (about)

     1  
     2  apiVersion: core.oam.dev/v1beta1
     3  kind: WorkflowStepDefinition
     4  metadata:
     5    name: suspend-and-deploy
     6    namespace: vela-system
     7  spec:
     8    schematic:
     9      cue:
    10        template: |
    11          import (
    12          	"strconv"
    13          	"strings"
    14          	"vela/op"
    15          )
    16          suspend: op.#Suspend & {duration: "1s"}
    17          output: op.#Apply & {
    18          	cluster: parameter.cluster
    19          	value: {
    20          		apiVersion: "apps/v1"
    21          		kind:       "Deployment"
    22          		metadata: {
    23          			name:      context.stepName
    24          			namespace: context.namespace
    25          		}
    26          		spec: {
    27          			selector: matchLabels: "workflow.oam.dev/step-name": "\(context.name)-\(context.stepName)"
    28          			replicas: parameter.replicas
    29          			template: {
    30          				metadata: labels: "workflow.oam.dev/step-name": "\(context.name)-\(context.stepName)"
    31          				spec: containers: [{
    32          					name:  context.stepName
    33          					image: parameter.image
    34          					if parameter["cmd"] != _|_ {
    35          						command: parameter.cmd
    36          					}
    37          				}]
    38          			}
    39          		}
    40          	}
    41          }
    42          wait: op.#ConditionalWait & {
    43          	continue: output.value.status.readyReplicas == parameter.replicas
    44          }
    45          parameter: {
    46          	image:    string
    47          	replicas: *1 | int
    48          	cluster:  *"" | string
    49          	cmd?: [...string]
    50          }
    51