From dfd4b13574fac26c5c90515a81ab0282c70dc8a7 Mon Sep 17 00:00:00 2001 From: = Date: Tue, 4 Feb 2025 16:14:28 +0530 Subject: [PATCH] fix: resolved base64 decode saving file as ansii --- helm-charts/secrets-operator/Chart.yaml | 4 ++-- helm-charts/secrets-operator/values.yaml | 2 +- .../infisicalsecret/infisical-secret-crd-with-template.yml | 2 +- .../controllers/infisicalsecret/infisicalsecret_helper.go | 5 ++--- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/helm-charts/secrets-operator/Chart.yaml b/helm-charts/secrets-operator/Chart.yaml index 161bf72a0b..e659c759fe 100644 --- a/helm-charts/secrets-operator/Chart.yaml +++ b/helm-charts/secrets-operator/Chart.yaml @@ -13,9 +13,9 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: v0.8.9 +version: v0.8.10 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. -appVersion: "v0.8.9" +appVersion: "v0.8.10" diff --git a/helm-charts/secrets-operator/values.yaml b/helm-charts/secrets-operator/values.yaml index 2cc3f666af..129cab06fa 100644 --- a/helm-charts/secrets-operator/values.yaml +++ b/helm-charts/secrets-operator/values.yaml @@ -32,7 +32,7 @@ controllerManager: - ALL image: repository: infisical/kubernetes-operator - tag: v0.8.8 + tag: v0.8.10 resources: limits: cpu: 500m diff --git a/k8-operator/config/samples/crd/infisicalsecret/infisical-secret-crd-with-template.yml b/k8-operator/config/samples/crd/infisicalsecret/infisical-secret-crd-with-template.yml index 127838772f..c1e0c86b9b 100644 --- a/k8-operator/config/samples/crd/infisicalsecret/infisical-secret-crd-with-template.yml +++ b/k8-operator/config/samples/crd/infisicalsecret/infisical-secret-crd-with-template.yml @@ -104,7 +104,7 @@ spec: includeAllSecrets: true data: SSH_KEY: "{{ .KEY.SecretPath }} {{ .KEY.Value }}" - BINARY_KEY: "{{ toBase64DecodedString .BINARY_KEY_BASE64.Value }}" + BINARY_KEY: "{{ decodeBase64ToBytes .BINARY_KEY_BASE64.Value }}" creationPolicy: "Orphan" ## Owner | Orphan # secretType: kubernetes.io/dockerconfigjson diff --git a/k8-operator/controllers/infisicalsecret/infisicalsecret_helper.go b/k8-operator/controllers/infisicalsecret/infisicalsecret_helper.go index 9b6055f0b3..f3800f9558 100644 --- a/k8-operator/controllers/infisicalsecret/infisicalsecret_helper.go +++ b/k8-operator/controllers/infisicalsecret/infisicalsecret_helper.go @@ -156,12 +156,12 @@ func (r *InfisicalSecretReconciler) getInfisicalServiceAccountCredentialsFromKub } var infisicalSecretTemplateFunctions = template.FuncMap{ - "decodeBase64ToBytes": func(encodedString string) []byte { + "decodeBase64ToBytes": func(encodedString string) string { decoded, err := base64.StdEncoding.DecodeString(encodedString) if err != nil { panic(fmt.Sprintf("Error: %v", err)) } - return decoded + return string(decoded) }, } @@ -222,7 +222,6 @@ func (r *InfisicalSecretReconciler) createInfisicalManagedKubeSecret(ctx context } annotations[constants.SECRET_VERSION_ANNOTATION] = ETag - // create a new secret as specified by the managed secret spec of CRD newKubeSecretInstance := &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{