Merge pull request #124 from sbidoul/more-jinja

Allow any kubefile to be a jinja template
This commit is contained in:
Stéphane Bidoul 2025-09-13 13:57:07 +02:00 committed by GitHub
commit 6b8c1ef0e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -200,10 +200,12 @@ def _render_kubefiles(
_logger.debug("kubefiles path: %s", kubefiles_path) _logger.debug("kubefiles path: %s", kubefiles_path)
# TODO async copytree, or make this whole _render_kubefiles run_in_executor # TODO async copytree, or make this whole _render_kubefiles run_in_executor
shutil.copytree(kubefiles_path, tmp_path, dirs_exist_ok=True) shutil.copytree(kubefiles_path, tmp_path, dirs_exist_ok=True)
template = Template((tmp_path / "kustomization.yaml.jinja").read_text()) for template_path in tmp_path.rglob("*.jinja"):
(tmp_path / "kustomization.yaml").write_text( template = Template(template_path.read_text())
template.render(dict(deployment_vars)) template_path.with_suffix("").write_text(
) template.render(dict(deployment_vars))
)
template_path.unlink()
yield tmp_path yield tmp_path