simplify template read
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Tobias Trabelsi 2022-09-10 15:07:34 +02:00
parent 53d2789128
commit 2685c5b97d
Signed by: lerentis
GPG Key ID: FF0C2839718CAF2E
2 changed files with 4 additions and 4 deletions

View File

@ -2,7 +2,7 @@
import os import os
import kopf import kopf
import kubernetes import kubernetes
from jinja2 import Environment, FileSystemLoader from jinja2 import Template
@kopf.on.create('bitwarden-secrets.lerentis.uploadfilter24.eu') @kopf.on.create('bitwarden-secrets.lerentis.uploadfilter24.eu')
@ -15,9 +15,9 @@ def create_fn(spec, name, namespace, logger, **kwargs):
api = kubernetes.client.CoreV1Api() api = kubernetes.client.CoreV1Api()
environment = Environment(loader=FileSystemLoader(os.path.join(os.path.dirname(__file__), '/templates'))) with open(os.path.join(os.path.dirname(__file__), '/templates/username-password.yaml.j2')) as file_:
template = Template(file_.read())
template = environment.get_template('username-password.yaml.j2')
data = template.render( data = template.render(
original_crd=name, original_crd=name,
secret_name=secret_name, secret_name=secret_name,

View File

@ -8,7 +8,7 @@ image:
repository: lerentis/bitwarden-crd-operator repository: lerentis/bitwarden-crd-operator
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion. # Overrides the image tag whose default is the chart appVersion.
tag: "28c2db9d18cfc98aa556764912bce8a981b09f22" tag: "53d27891282b91cd379f1d28ccbaec0100d19dfa"
imagePullSecrets: [] imagePullSecrets: []
nameOverride: "" nameOverride: ""