github.com/kubevela/workflow@v0.6.0/charts/vela-workflow/templates/definitions/export2secret.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/export2secret.cue
     3  apiVersion: core.oam.dev/v1beta1
     4  kind: WorkflowStepDefinition
     5  metadata:
     6    annotations:
     7      definition.oam.dev/description: Export data to Kubernetes Secret in your workflow.
     8    labels:
     9      custom.definition.oam.dev/ui-hidden: "true"
    10    name: export2secret
    11    namespace: {{ include "systemDefinitionNamespace" . }}
    12  spec:
    13    schematic:
    14      cue:
    15        template: |
    16          import (
    17          	"vela/op"
    18          	"encoding/base64"
    19          	"encoding/json"
    20          )
    21  
    22          secret: op.#Steps & {
    23          	data: *parameter.data | {}
    24          	if parameter.kind == "docker-registry" && parameter.dockerRegistry != _|_ {
    25          		registryData: auths: "\(parameter.dockerRegistry.server)": {
    26          			username: parameter.dockerRegistry.username
    27          			password: parameter.dockerRegistry.password
    28          			auth:     base64.Encode(null, "\(parameter.dockerRegistry.username):\(parameter.dockerRegistry.password)")
    29          		}
    30          		data: ".dockerconfigjson": json.Marshal(registryData)
    31          	}
    32          	apply: op.#Apply & {
    33          		value: {
    34          			apiVersion: "v1"
    35          			kind:       "Secret"
    36          			if parameter.type == _|_ && parameter.kind == "docker-registry" {
    37          				type: "kubernetes.io/dockerconfigjson"
    38          			}
    39          			if parameter.type != _|_ {
    40          				type: parameter.type
    41          			}
    42          			metadata: {
    43          				name: parameter.secretName
    44          				if parameter.namespace != _|_ {
    45          					namespace: parameter.namespace
    46          				}
    47          				if parameter.namespace == _|_ {
    48          					namespace: context.namespace
    49          				}
    50          			}
    51          			stringData: data
    52          		}
    53          		cluster: parameter.cluster
    54          	}
    55          }
    56          parameter: {
    57          	// +usage=Specify the name of the secret
    58          	secretName: string
    59          	// +usage=Specify the namespace of the secret
    60          	namespace?: string
    61          	// +usage=Specify the type of the secret
    62          	type?: string
    63          	// +usage=Specify the data of secret
    64          	data: {}
    65          	// +usage=Specify the cluster of the secret
    66          	cluster: *"" | string
    67          	// +usage=Specify the kind of the secret
    68          	kind: *"generic" | "docker-registry"
    69          	// +usage=Specify the docker data
    70          	dockerRegistry?: {
    71          		// +usage=Specify the username of the docker registry
    72          		username: string
    73          		// +usage=Specify the password of the docker registry
    74          		password: string
    75          		// +usage=Specify the server of the docker registry
    76          		server: *"https://index.docker.io/v1/" | string
    77          	}
    78          }
    79