github.com/oam-dev/kubevela@v1.9.11/charts/vela-core/templates/defwithtemplate/depends-on-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/depends-on-app.cue
     3  apiVersion: core.oam.dev/v1beta1
     4  kind: WorkflowStepDefinition
     5  metadata:
     6    annotations:
     7      custom.definition.oam.dev/category: Application Delivery
     8      definition.oam.dev/description: Wait for the specified Application to complete.
     9    name: depends-on-app
    10    namespace: {{ include "systemDefinitionNamespace" . }}
    11  spec:
    12    schematic:
    13      cue:
    14        template: |
    15          import (
    16          	"vela/op"
    17          	"encoding/yaml"
    18          )
    19  
    20          dependsOn: op.#Read & {
    21          	value: {
    22          		apiVersion: "core.oam.dev/v1beta1"
    23          		kind:       "Application"
    24          		metadata: {
    25          			name:      parameter.name
    26          			namespace: parameter.namespace
    27          		}
    28          	}
    29          }
    30          load: op.#Steps & {
    31          	if dependsOn.err != _|_ {
    32          		configMap: op.#Read & {
    33          			value: {
    34          				apiVersion: "v1"
    35          				kind:       "ConfigMap"
    36          				metadata: {
    37          					name:      parameter.name
    38          					namespace: parameter.namespace
    39          				}
    40          			}
    41          		}         @step(1)
    42          		template: configMap.value.data["application"]
    43          		apply:    op.#Apply & {
    44          			value: yaml.Unmarshal(template)
    45          		}     @step(2)
    46          		wait: op.#ConditionalWait & {
    47          			continue: apply.value.status.status == "running"
    48          		} @step(3)
    49          	}
    50  
    51          	if dependsOn.err == _|_ {
    52          		wait: op.#ConditionalWait & {
    53          			continue: dependsOn.value.status.status == "running"
    54          		}
    55          	}
    56          }
    57          parameter: {
    58          	// +usage=Specify the name of the dependent Application
    59          	name: string
    60          	// +usage=Specify the namespace of the dependent Application
    61          	namespace: string
    62          }
    63