Files
kubevela/charts/vela-minimal/templates/defwithtemplate/export2secret.yaml
2023-02-10 14:23:04 +08:00

79 lines
2.7 KiB
YAML

# 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:
custom.definition.oam.dev/category: Resource Management
definition.oam.dev/description: Export data to Kubernetes Secret in your workflow.
name: export2secret
namespace: {{ include "systemDefinitionNamespace" . }}
spec:
schematic:
cue:
template: |
import (
"vela/op"
"encoding/base64"
"encoding/json"
)
secret: op.#Steps & {
data: *parameter.data | {}
if parameter.kind == "docker-registry" && parameter.dockerRegistry != _|_ {
registryData: auths: "\(parameter.dockerRegistry.server)": {
username: parameter.dockerRegistry.username
password: parameter.dockerRegistry.password
auth: base64.Encode(null, "\(parameter.dockerRegistry.username):\(parameter.dockerRegistry.password)")
}
data: ".dockerconfigjson": json.Marshal(registryData)
}
apply: op.#Apply & {
value: {
apiVersion: "v1"
kind: "Secret"
if parameter.type == _|_ && parameter.kind == "docker-registry" {
type: "kubernetes.io/dockerconfigjson"
}
if parameter.type != _|_ {
type: parameter.type
}
metadata: {
name: parameter.secretName
if parameter.namespace != _|_ {
namespace: parameter.namespace
}
if parameter.namespace == _|_ {
namespace: context.namespace
}
}
stringData: data
}
cluster: parameter.cluster
}
}
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: {}
// +usage=Specify the cluster of the secret
cluster: *"" | string
// +usage=Specify the kind of the secret
kind: *"generic" | "docker-registry"
// +usage=Specify the docker data
dockerRegistry?: {
// +usage=Specify the username of the docker registry
username: string
// +usage=Specify the password of the docker registry
password: string
// +usage=Specify the server of the docker registry
server: *"https://index.docker.io/v1/" | string
}
}