github.com/oam-dev/kubevela@v1.9.11/charts/vela-core/templates/defwithtemplate/apply-deployment.yaml (about)

     1  # Code generated by KubeVela templates. DO NOT EDIT. Please edit the original cue file.
     2  # Definition source cue file: vela-templates/definitions/internal/apply-deployment.cue
     3  apiVersion: core.oam.dev/v1beta1
     4  kind: WorkflowStepDefinition
     5  metadata:
     6    annotations:
     7      custom.definition.oam.dev/category: Resource Management
     8      definition.oam.dev/alias: ""
     9      definition.oam.dev/description: Apply deployment with specified image and cmd.
    10    name: apply-deployment
    11    namespace: {{ include "systemDefinitionNamespace" . }}
    12  spec:
    13    schematic:
    14      cue:
    15        template: |
    16          import (
    17          	"strconv"
    18          	"strings"
    19          	"vela/op"
    20          )
    21  
    22          output: op.#Apply & {
    23          	cluster: parameter.cluster
    24          	value: {
    25          		apiVersion: "apps/v1"
    26          		kind:       "Deployment"
    27          		metadata: {
    28          			name:      context.stepName
    29          			namespace: context.namespace
    30          		}
    31          		spec: {
    32          			selector: matchLabels: "workflow.oam.dev/step-name": "\(context.name)-\(context.stepName)"
    33          			replicas: parameter.replicas
    34          			template: {
    35          				metadata: labels: "workflow.oam.dev/step-name": "\(context.name)-\(context.stepName)"
    36          				spec: containers: [{
    37          					name:  context.stepName
    38          					image: parameter.image
    39          					if parameter["cmd"] != _|_ {
    40          						command: parameter.cmd
    41          					}
    42          				}]
    43          			}
    44          		}
    45          	}
    46          }
    47          wait: op.#ConditionalWait & {
    48          	continue: output.value.status.readyReplicas == parameter.replicas
    49          }
    50          parameter: {
    51          	image:    string
    52          	replicas: *1 | int
    53          	cluster:  *"" | string
    54          	cmd?: [...string]
    55          }
    56