Merge pull request #124 from sbidoul/more-jinja
Allow any kubefile to be a jinja template
This commit is contained in:
commit
6b8c1ef0e0
1 changed files with 6 additions and 4 deletions
|
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue