github.com/oam-dev/kubevela@v1.9.11/vela-templates/definitions/internal/workflowstep/apply-deployment.cue (about)

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