From a1bd1c15e26cc0c70c86b82a7ff9b73afe4cd021 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Sat, 13 Sep 2025 13:55:10 +0200 Subject: [PATCH] Allow any kubefile to be a jinja template This is simpler than patching in the kustomization.yaml.jinja --- src/runboat/k8s.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/runboat/k8s.py b/src/runboat/k8s.py index 8d83a90..6749ab3 100644 --- a/src/runboat/k8s.py +++ b/src/runboat/k8s.py @@ -200,10 +200,12 @@ def _render_kubefiles( _logger.debug("kubefiles path: %s", kubefiles_path) # TODO async copytree, or make this whole _render_kubefiles run_in_executor shutil.copytree(kubefiles_path, tmp_path, dirs_exist_ok=True) - template = Template((tmp_path / "kustomization.yaml.jinja").read_text()) - (tmp_path / "kustomization.yaml").write_text( - template.render(dict(deployment_vars)) - ) + for template_path in tmp_path.rglob("*.jinja"): + template = Template(template_path.read_text()) + template_path.with_suffix("").write_text( + template.render(dict(deployment_vars)) + ) + template_path.unlink() yield tmp_path