Kubernetes Secret and stringData #394
-
Hi there! New to Timoni and I really like what I'm seeing so far! 🙏 I'm trying to figure out what's the best way to create a template for a Secret with stringData. I have a Secret in Kubernetes which contains a configuration file. This file is mounted to the pod and read at startup. apiVersion: v1
kind: Secret
metadata:
(...)
type: Opaque
stringData:
configuration.yaml: |
foo:
host: some.host.example.com
password: encrypted-with-helm-secrets-at-rest The my current setup: config.cue: (...)
#Config: {
secret: [string]: string
} secret.cue: package templates
import (
corev1 "k8s.io/api/core/v1"
)
#Secret: corev1.#Secret & {
#config: #Config
apiVersion: "v1"
kind: "Secret"
metadata: #config.metadata
type: corev1.#SecretTypeOpaque
stringData: #config.secret
} values.cue: values: {
secret: "configuration.yaml": """
foo:
host: some.host.example.com
"""
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The configuration can be a CUE definition that gets converted to YAML, something like: import "encoding/yaml"
#Config: {
cfg: #SomeConfig
}
#Instance: {
config: #Config
objects: {
sa: #Secret & {#config: config}
}
#Secret: corev1.#Secret & {
#config: #Config
_cfgYAML: yaml.Marshal(#config.cfg)
}``` |
Beta Was this translation helpful? Give feedback.
The configuration can be a CUE definition that gets converted to YAML, something like: