github.com/oam-dev/kubevela@v1.9.11/charts/vela-core/templates/defwithtemplate/export-data.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/export-data.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: Export data to clusters specified by topology.
     9    labels:
    10      custom.definition.oam.dev/scope: Application
    11    name: export-data
    12    namespace: {{ include "systemDefinitionNamespace" . }}
    13  spec:
    14    schematic:
    15      cue:
    16        template: |
    17          import (
    18          	"vela/op"
    19          )
    20  
    21          object: {
    22          	apiVersion: "v1"
    23          	kind:       parameter.kind
    24          	metadata: {
    25          		name:      *context.name | string
    26          		namespace: *context.namespace | string
    27          		if parameter.name != _|_ {
    28          			name: parameter.name
    29          		}
    30          		if parameter.namespace != _|_ {
    31          			namespace: parameter.namespace
    32          		}
    33          	}
    34          	if parameter.kind == "ConfigMap" {
    35          		data: parameter.data
    36          	}
    37          	if parameter.kind == "Secret" {
    38          		stringData: parameter.data
    39          	}
    40          } @step(1)
    41  
    42          getPlacements: op.#GetPlacementsFromTopologyPolicies & {
    43          	policies: *[] | [...string]
    44          	if parameter.topology != _|_ {
    45          		policies: [parameter.topology]
    46          	}
    47          } @step(2)
    48  
    49          apply: op.#Steps & {
    50          	for p in getPlacements.placements {
    51          		(p.cluster): op.#Apply & {
    52          			value:   object
    53          			cluster: p.cluster
    54          		}
    55          	}
    56          } @step(3)
    57  
    58          parameter: {
    59          	// +usage=Specify the name of the export destination
    60          	name?: string
    61          	// +usage=Specify the namespace of the export destination
    62          	namespace?: string
    63          	// +usage=Specify the kind of the export destination
    64          	kind: *"ConfigMap" | "Secret"
    65          	// +usage=Specify the data to export
    66          	data: {}
    67          	// +usage=Specify the topology to export
    68          	topology?: string
    69          }
    70