From 4f3fc82e48c8b33611fa4939c8a8018ffafec2ba Mon Sep 17 00:00:00 2001 From: Tobias Trabelsi Date: Sat, 10 Sep 2022 15:23:53 +0200 Subject: [PATCH] base64 is no native filter in jinja --- bitwarden-crd-operator.py | 5 +++-- chart/bitwarden-crd-operator/values.yaml | 2 +- templates/username-password.yaml.j2 | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/bitwarden-crd-operator.py b/bitwarden-crd-operator.py index 8d1f734..300b4e5 100755 --- a/bitwarden-crd-operator.py +++ b/bitwarden-crd-operator.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 import kopf import kubernetes +import base64 from jinja2 import Template @@ -22,8 +23,8 @@ def create_fn(spec, name, namespace, logger, **kwargs): original_crd=name, secret_name=secret_name, namespace=secret_namespace, - username="test", - password="test" + username=base64.b64encode("test"), + password=base64.b64encode("test") ) obj = api.create_namespaced_secret( diff --git a/chart/bitwarden-crd-operator/values.yaml b/chart/bitwarden-crd-operator/values.yaml index 648648c..f222c62 100644 --- a/chart/bitwarden-crd-operator/values.yaml +++ b/chart/bitwarden-crd-operator/values.yaml @@ -8,7 +8,7 @@ image: repository: lerentis/bitwarden-crd-operator pullPolicy: IfNotPresent # Overrides the image tag whose default is the chart appVersion. - tag: "2685c5b97d76bf00ed4c15519b699ae88682078f" + tag: "97fced6969e32d0c7e0975865f26ebbc43f1cd8a" imagePullSecrets: [] nameOverride: "" diff --git a/templates/username-password.yaml.j2 b/templates/username-password.yaml.j2 index 56d0858..95aafbc 100644 --- a/templates/username-password.yaml.j2 +++ b/templates/username-password.yaml.j2 @@ -8,5 +8,5 @@ metadata: namespace: "{{ namespace }}" type: Opaque data: - username: "{{ username | base64 }}" - password: "{{ password | base64 }}" + username: "{{ username }}" + password: "{{ password }}"