github.com/kubevela/workflow@v0.6.0/charts/vela-workflow/templates/definitions/apply-app.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-app.cue
     3  apiVersion: core.oam.dev/v1beta1
     4  kind: WorkflowStepDefinition
     5  metadata:
     6    annotations:
     7      definition.oam.dev/alias: ""
     8      definition.oam.dev/description: Apply application from data or ref to the cluster
     9      definition.oam.dev/example-url: https://raw.githubusercontent.com/kubevela/workflow/main/examples/workflow-run/apply-applications.yaml
    10    labels:
    11      custom.definition.oam.dev/scope: WorkflowRun
    12    name: apply-app
    13    namespace: {{ include "systemDefinitionNamespace" . }}
    14  spec:
    15    schematic:
    16      cue:
    17        template: |
    18          import (
    19          	"vela/op"
    20          	"encoding/yaml"
    21          )
    22  
    23          app: op.#Steps & {
    24          	if parameter.data != _|_ {
    25          		apply: op.#Apply & {
    26          			value: parameter.data
    27          		}
    28          	}
    29          	if parameter.ref != _|_ {
    30          		if parameter.ref.type == "configMap" {
    31          			cm: op.#Read & {
    32          				value: {
    33          					apiVersion: "v1"
    34          					kind:       "ConfigMap"
    35          					metadata: {
    36          						name:      parameter.ref.name
    37          						namespace: parameter.ref.namespace
    38          					}
    39          				}
    40          			}
    41          			template: cm.value.data[parameter.ref.key]
    42          			apply:    op.#Apply & {
    43          				value: yaml.Unmarshal(template)
    44          			}
    45          		}
    46          	}
    47          }
    48          wait: op.#ConditionalWait & {
    49          	continue: app.apply.value.status.status == "running" && app.apply.value.status.observedGeneration == app.apply.value.metadata.generation
    50          }
    51          parameter: close({
    52          	data?: {...}
    53          }) | close({
    54          	ref?: {
    55          		name:      string
    56          		namespace: *context.namespace | string
    57          		type:      *"configMap" | string
    58          		key:       *"application" | string
    59          	}
    60          })
    61