Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
feat: added base64DecodeBytes function to operator template
=9823c7d1aa2a
diff --git a/k8-operator/config/samples/sample-with-template.yml b/k8-operator/config/samples/crd/infisicalsecret/infisical-secret-crd-with-template.ymlsimilarity index 98%rename from k8-operator/config/samples/sample-with-template.ymlrename to k8-operator/config/samples/crd/infisicalsecret/infisical-secret-crd-with-template.ymlindex 9d9d86ab58..e167583a79 100644--- a/k8-operator/config/samples/sample-with-template.yml+++ b/k8-operator/config/samples/crd/infisicalsecret/infisical-secret-crd-with-template.yml@@ -104,6 +104,7 @@ spec:includeAllSecrets: truedata:SSH_KEY: "{{ .KEY.SecretPath }} {{ .KEY.Value }}"+ BINARY_KEY: "{{ base64DecodeBytes .BINARY_KEY_BASE64.Value }}"creationPolicy: "Orphan" ## Owner | Orphan# secretType: kubernetes.io/dockerconfigjsondiff --git a/k8-operator/controllers/infisicalsecret/infisicalsecret_helper.go b/k8-operator/controllers/infisicalsecret/infisicalsecret_helper.goindex 28a9843c90..8fb41621af 100644--- a/k8-operator/controllers/infisicalsecret/infisicalsecret_helper.go+++ b/k8-operator/controllers/infisicalsecret/infisicalsecret_helper.go@@ -3,6 +3,7 @@ package controllersimport ("bytes""context"+ "encoding/base64""errors""fmt""strings"@@ -261,7 +262,15 @@ func (r *InfisicalSecretReconciler) updateInfisicalManagedKubeSecret(ctx context}for templateKey, userTemplate := range managedTemplateData.Data {- tmpl, err := template.New("secret-templates").Parse(userTemplate)+ tmpl, err := template.New("secret-templates").Funcs(template.FuncMap{+ "base64DecodeBytes": func(encodedString string) string {+ decoded, err := base64.StdEncoding.DecodeString(encodedString)+ if err != nil {+ return fmt.Sprintf("Error: %v", err)+ }+ return string(decoded)+ },+ }).Parse(userTemplate)if err != nil {return fmt.Errorf("unable to compile template: %s [err=%v]", templateKey, err)}