diff --git a/charts/vela-core/templates/defwithtemplate/export2config.yaml b/charts/vela-core/templates/defwithtemplate/export2config.yaml new file mode 100644 index 000000000..4f8d5bb1c --- /dev/null +++ b/charts/vela-core/templates/defwithtemplate/export2config.yaml @@ -0,0 +1,42 @@ +# Code generated by KubeVela templates. DO NOT EDIT. Please edit the original cue file. +# Definition source cue file: vela-templates/definitions/internal/export2config.cue +apiVersion: core.oam.dev/v1beta1 +kind: WorkflowStepDefinition +metadata: + annotations: + definition.oam.dev/description: Export data to config map for your workflow steps + name: export2config + namespace: {{.Values.systemDefinitionNamespace}} +spec: + schematic: + cue: + template: | + import ( + "vela/op" + ) + + apply: op.#Apply & { + value: { + apiVersion: "v1" + kind: "ConfigMap" + metadata: { + name: parameter.configName + if parameter.namespace != _|_ { + namespace: parameter.namespace + } + if parameter.namespace == _|_ { + namespace: context.namespace + } + } + data: parameter.data + } + } + parameter: { + // +usage=Specify the name of the config map + configName: string + // +usage=Specify the namespace of the config map + namespace?: string + // +usage=Specify the data of config map + data: {} + } + diff --git a/charts/vela-core/templates/defwithtemplate/export2secret.yaml b/charts/vela-core/templates/defwithtemplate/export2secret.yaml new file mode 100644 index 000000000..0d1262e51 --- /dev/null +++ b/charts/vela-core/templates/defwithtemplate/export2secret.yaml @@ -0,0 +1,47 @@ +# Code generated by KubeVela templates. DO NOT EDIT. Please edit the original cue file. +# Definition source cue file: vela-templates/definitions/internal/export2secret.cue +apiVersion: core.oam.dev/v1beta1 +kind: WorkflowStepDefinition +metadata: + annotations: + definition.oam.dev/description: Export data to secret for your workflow steps + name: export2secret + namespace: {{.Values.systemDefinitionNamespace}} +spec: + schematic: + cue: + template: | + import ( + "vela/op" + ) + + apply: op.#Apply & { + value: { + apiVersion: "v1" + kind: "Secret" + if parameter.type != _|_ { + type: parameter.type + } + metadata: { + name: parameter.secretName + if parameter.namespace != _|_ { + namespace: parameter.namespace + } + if parameter.namespace == _|_ { + namespace: context.namespace + } + } + stringData: parameter.data + } + } + parameter: { + // +usage=Specify the name of the secret + secretName: string + // +usage=Specify the namespace of the secret + namespace?: string + // +usage=Specify the type of the secret + type?: string + // +usage=Specify the data of secret + data: {} + } + diff --git a/charts/vela-minimal/templates/defwithtemplate/export2config.yaml b/charts/vela-minimal/templates/defwithtemplate/export2config.yaml new file mode 100644 index 000000000..4f8d5bb1c --- /dev/null +++ b/charts/vela-minimal/templates/defwithtemplate/export2config.yaml @@ -0,0 +1,42 @@ +# Code generated by KubeVela templates. DO NOT EDIT. Please edit the original cue file. +# Definition source cue file: vela-templates/definitions/internal/export2config.cue +apiVersion: core.oam.dev/v1beta1 +kind: WorkflowStepDefinition +metadata: + annotations: + definition.oam.dev/description: Export data to config map for your workflow steps + name: export2config + namespace: {{.Values.systemDefinitionNamespace}} +spec: + schematic: + cue: + template: | + import ( + "vela/op" + ) + + apply: op.#Apply & { + value: { + apiVersion: "v1" + kind: "ConfigMap" + metadata: { + name: parameter.configName + if parameter.namespace != _|_ { + namespace: parameter.namespace + } + if parameter.namespace == _|_ { + namespace: context.namespace + } + } + data: parameter.data + } + } + parameter: { + // +usage=Specify the name of the config map + configName: string + // +usage=Specify the namespace of the config map + namespace?: string + // +usage=Specify the data of config map + data: {} + } + diff --git a/charts/vela-minimal/templates/defwithtemplate/export2secret.yaml b/charts/vela-minimal/templates/defwithtemplate/export2secret.yaml new file mode 100644 index 000000000..0d1262e51 --- /dev/null +++ b/charts/vela-minimal/templates/defwithtemplate/export2secret.yaml @@ -0,0 +1,47 @@ +# Code generated by KubeVela templates. DO NOT EDIT. Please edit the original cue file. +# Definition source cue file: vela-templates/definitions/internal/export2secret.cue +apiVersion: core.oam.dev/v1beta1 +kind: WorkflowStepDefinition +metadata: + annotations: + definition.oam.dev/description: Export data to secret for your workflow steps + name: export2secret + namespace: {{.Values.systemDefinitionNamespace}} +spec: + schematic: + cue: + template: | + import ( + "vela/op" + ) + + apply: op.#Apply & { + value: { + apiVersion: "v1" + kind: "Secret" + if parameter.type != _|_ { + type: parameter.type + } + metadata: { + name: parameter.secretName + if parameter.namespace != _|_ { + namespace: parameter.namespace + } + if parameter.namespace == _|_ { + namespace: context.namespace + } + } + stringData: parameter.data + } + } + parameter: { + // +usage=Specify the name of the secret + secretName: string + // +usage=Specify the namespace of the secret + namespace?: string + // +usage=Specify the type of the secret + type?: string + // +usage=Specify the data of secret + data: {} + } + diff --git a/docs/examples/workflow/export2config/app.yaml b/docs/examples/workflow/export2config/app.yaml new file mode 100644 index 000000000..bc60a0e86 --- /dev/null +++ b/docs/examples/workflow/export2config/app.yaml @@ -0,0 +1,28 @@ +apiVersion: core.oam.dev/v1beta1 +kind: Application +metadata: + name: export-config + namespace: default +spec: + components: + - name: express-server + type: webservice + properties: + image: crccheck/hello-world + port: 8000 + workflow: + steps: + - name: apply-server + type: apply-component + outputs: + - name: status + valueFrom: output.status.conditions[0].message + properties: + component: express-server + - name: export-config + type: export-config + inputs: + - from: status + parameterKey: data.serverstatus + properties: + configName: my-configmap diff --git a/docs/examples/workflow/export2secret/app.yaml b/docs/examples/workflow/export2secret/app.yaml new file mode 100644 index 000000000..0dbfe1cbb --- /dev/null +++ b/docs/examples/workflow/export2secret/app.yaml @@ -0,0 +1,28 @@ +apiVersion: core.oam.dev/v1beta1 +kind: Application +metadata: + name: export-secret + namespace: default +spec: + components: + - name: express-server + type: webservice + properties: + image: crccheck/hello-world + port: 8000 + workflow: + steps: + - name: apply-server + type: apply-component + outputs: + - name: status + valueFrom: output.status.conditions[0].message + properties: + component: express-server + - name: export-secret + type: export-secret + inputs: + - from: status + parameterKey: data.serverstatus + properties: + secretName: my-secret diff --git a/vela-templates/definitions/internal/export2config.cue b/vela-templates/definitions/internal/export2config.cue new file mode 100644 index 000000000..8b757712d --- /dev/null +++ b/vela-templates/definitions/internal/export2config.cue @@ -0,0 +1,36 @@ +import ( + "vela/op" +) + +"export2config": { + type: "workflow-step" + annotations: {} + labels: {} + description: "Export data to config map for your workflow steps" +} +template: { + apply: op.#Apply & { + value: { + apiVersion: "v1" + kind: "ConfigMap" + metadata: { + name: parameter.configName + if parameter.namespace != _|_ { + namespace: parameter.namespace + } + if parameter.namespace == _|_ { + namespace: context.namespace + } + } + data: parameter.data + } + } + parameter: { + // +usage=Specify the name of the config map + configName: string + // +usage=Specify the namespace of the config map + namespace?: string + // +usage=Specify the data of config map + data: {} + } +} diff --git a/vela-templates/definitions/internal/export2secret.cue b/vela-templates/definitions/internal/export2secret.cue new file mode 100644 index 000000000..c28a13f43 --- /dev/null +++ b/vela-templates/definitions/internal/export2secret.cue @@ -0,0 +1,41 @@ +import ( + "vela/op" +) + +"export2secret": { + type: "workflow-step" + annotations: {} + labels: {} + description: "Export data to secret for your workflow steps" +} +template: { + apply: op.#Apply & { + value: { + apiVersion: "v1" + kind: "Secret" + if parameter.type != _|_ { + type: parameter.type + } + metadata: { + name: parameter.secretName + if parameter.namespace != _|_ { + namespace: parameter.namespace + } + if parameter.namespace == _|_ { + namespace: context.namespace + } + } + stringData: parameter.data + } + } + parameter: { + // +usage=Specify the name of the secret + secretName: string + // +usage=Specify the namespace of the secret + namespace?: string + // +usage=Specify the type of the secret + type?: string + // +usage=Specify the data of secret + data: {} + } +}