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