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

     1  import (
     2  	"vela/op"
     3  )
     4  
     5  "export-data": {
     6  	type: "workflow-step"
     7  	annotations: {
     8  		"category": "Application Delivery"
     9  	}
    10  	labels: {
    11  		"scope": "Application"
    12  	}
    13  	description: "Export data to clusters specified by topology."
    14  }
    15  template: {
    16  	object: {
    17  		apiVersion: "v1"
    18  		kind:       parameter.kind
    19  		metadata: {
    20  			name:      *context.name | string
    21  			namespace: *context.namespace | string
    22  			if parameter.name != _|_ {
    23  				name: parameter.name
    24  			}
    25  			if parameter.namespace != _|_ {
    26  				namespace: parameter.namespace
    27  			}
    28  		}
    29  		if parameter.kind == "ConfigMap" {
    30  			data: parameter.data
    31  		}
    32  		if parameter.kind == "Secret" {
    33  			stringData: parameter.data
    34  		}
    35  	} @step(1)
    36  
    37  	getPlacements: op.#GetPlacementsFromTopologyPolicies & {
    38  		policies: *[] | [...string]
    39  		if parameter.topology != _|_ {
    40  			policies: [parameter.topology]
    41  		}
    42  	} @step(2)
    43  
    44  	apply: op.#Steps & {
    45  		for p in getPlacements.placements {
    46  			(p.cluster): op.#Apply & {
    47  				value:   object
    48  				cluster: p.cluster
    49  			}
    50  		}
    51  	} @step(3)
    52  
    53  	parameter: {
    54  		// +usage=Specify the name of the export destination
    55  		name?: string
    56  		// +usage=Specify the namespace of the export destination
    57  		namespace?: string
    58  		// +usage=Specify the kind of the export destination
    59  		kind: *"ConfigMap" | "Secret"
    60  		// +usage=Specify the data to export
    61  		data: {}
    62  		// +usage=Specify the topology to export
    63  		topology?: string
    64  	}
    65  }