docs/snippets/kubernetes-operator-templating-helpers.mdx
The Infisical Secrets Operator exposes a wide range of helper functions to make it easier to work with secrets in Kubernetes.
<AccordionGroup> <Accordion title="encodeBase64"> Encodes a string to a base64-encoded string (e.g. `hello world` becomes `aGVsbG8gd29ybGQ=`).Signature
encodeBase64(plainString string) string
Template usage
template:
data:
ENCODED_SECRET: "{{ .MY_SECRET.Value | encodeBase64 }}"
Signature
decodeBase64ToBytes(encodedString string) string
Template usage
template:
data:
DECODED_SECRET: "{{ .MY_BASE64_SECRET.Value | decodeBase64ToBytes }}"
Signature
pkcs12key(input string) string
Template usage
template:
data:
tls.key: "{{ .TLS_CERT_PKCS12.Value | pkcs12key }}"
Signature
pkcs12keyPass(password string, input string) string
Template usage
template:
data:
tls.key: '{{ pkcs12keyPass "my-password" .TLS_CERT_PKCS12.Value }}'
Signature
pkcs12cert(input string) string
Template usage
template:
data:
tls.crt: "{{ .TLS_CERT_PKCS12.Value | pkcs12cert }}"
Signature
pkcs12certPass(password string, input string) string
Template usage
template:
data:
tls.crt: '{{ pkcs12certPass "my-password" .TLS_CERT_PKCS12.Value }}'
Signature
pemToPkcs12(cert string, key string) string
Template usage
template:
data:
keystore.p12: '{{ pemToPkcs12 .TLS_CERT.Value .TLS_KEY.Value }}'
Signature
pemToPkcs12Pass(cert string, key string, password string) string
Template usage
template:
data:
keystore.p12: '{{ pemToPkcs12Pass .TLS_CERT.Value .TLS_KEY.Value "my-password" }}'
Signature
fullPemToPkcs12(cert string, key string) string
Template usage
template:
data:
keystore.p12: '{{ fullPemToPkcs12 .TLS_FULL_CHAIN.Value .TLS_KEY.Value }}'
Signature
fullPemToPkcs12Pass(cert string, key string, password string) string
Template usage
template:
data:
keystore.p12: '{{ fullPemToPkcs12Pass .TLS_FULL_CHAIN.Value .TLS_KEY.Value "my-password" }}'
Signature
filterPEM(pemType string, input string) string
Template usage
template:
data:
ca.crt: '{{ filterPEM "CERTIFICATE" .TLS_BUNDLE.Value }}'
tls.key: '{{ filterPEM "PRIVATE KEY" .TLS_BUNDLE.Value }}'
Signature
filterCertChain(certType string, input string) string
Template usage
template:
data:
tls.crt: '{{ filterCertChain "leaf" .TLS_CHAIN.Value }}'
ca.crt: '{{ filterCertChain "root" .TLS_CHAIN.Value }}'
intermediate.crt: '{{ filterCertChain "intermediate" .TLS_CHAIN.Value }}'
Signature
jwkPublicKeyPem(jwkJson string) string
Template usage
template:
data:
public.pem: "{{ .MY_JWK.Value | jwkPublicKeyPem }}"
Signature
jwkPrivateKeyPem(jwkJson string) string
Template usage
template:
data:
private.pem: "{{ .MY_JWK.Value | jwkPrivateKeyPem }}"
Signature
toYaml(v any) string
Template usage
template:
data:
config.yaml: "{{ .APP_CONFIG.Value | fromYaml | toYaml }}"
Signature
fromYaml(str string) map[string]any
Template usage
template:
data:
DB_HOST: '{{ (fromYaml .DB_CONFIG.Value).host }}'
DB_PORT: '{{ (fromYaml .DB_CONFIG.Value).port }}'
The Infisical Secrets Operator integrates with the Sprig library to provide additional helper functions.
<Note> We've removed `expandEnv` and `env` from the supported functions for security reasons. </Note>