# Code generated by KubeVela templates. DO NOT EDIT. Please edit the original cue file.
# Definition source cue file: vela-templates/definitions/deprecated/deploy2runtime.cue
apiVersion: core.oam.dev/v1beta1
kind: WorkflowStepDefinition
metadata:
  annotations:
    definition.oam.dev/description: Deploy application to runtime clusters
  labels:
    custom.definition.oam.dev/deprecated: "true"
    custom.definition.oam.dev/scope: Application
    custom.definition.oam.dev/ui-hidden: "true"
  name: deploy2runtime
  namespace: {{ include "systemDefinitionNamespace" . }}
spec:
  schematic:
    cue:
      template: |
        import (
        	"vela/op"
        )

        app: op.#Steps & {
        	load: op.#Load
        	clusters: [...string]
        	if parameter.clusters == _|_ {
        		listClusters: op.#ListClusters
        		clusters:     listClusters.outputs.clusters
        	}
        	if parameter.clusters != _|_ {
        		clusters: parameter.clusters
        	}

        	apply: op.#Steps & {
        		for _, cluster_ in clusters {
        			for name, c in load.value {
        				"\(cluster_)-\(name)": op.#ApplyComponent & {
        					value:   c
        					cluster: cluster_
        				}
        			}
        		}
        	}
        }

        parameter: {
        	// +usage=Declare the runtime clusters to apply, if empty, all runtime clusters will be used
        	clusters?: [...string]
        }

