Skip to content

Commit f2fc7b9

Browse files
author
lb0o
committed
[docs] Extend makefile with render-template that ease YAML template rendering for development.
Littly hacky addition of a render-template method in order to verify and rapidly iterate development of new talm templating functionnalities. Ass the capacity to pass any parametes the talm template commands. Signed-off-by: lb0o <lb0o@nocilo.com>
1 parent d5e0162 commit f2fc7b9

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,18 @@ import-internal:
5454
talos-$(TALOS_VERSION)/internal/pkg
5555
rm -rf internal/app/init/ internal/pkg/rng/ internal/pkg/tui/
5656
sed -i 's|github.com/siderolabs/talos/internal|github.com/cozystack/talm/internal|g' `grep -rl 'github.com/siderolabs/talos/internal' internal`
57+
58+
render-template: build
59+
@echo "Rendering templates..."; \
60+
TALM_PATH="`pwd`/talm"; \
61+
TMPDIR="`mktemp -d -t talm-tmp.XXXXXX`"; \
62+
echo "Initializing template workspace in $$TMPDIR..."; \
63+
cd "$$TMPDIR"; \
64+
if [ ! -x "$$TALM_PATH" ]; then echo "Error: '$$TALM_PATH' not found or not executable."; exit 127; fi; \
65+
"$$TALM_PATH" init --preset cozystack; \
66+
echo; echo "--------- Rendering controlplane.yaml template ---------"; \
67+
"$$TALM_PATH" template -t templates/controlplane.yaml --offline $(SET_ARGS); \
68+
echo; echo "--------- Rendering worker.yaml template ---------"; \
69+
"$$TALM_PATH" template -t templates/worker.yaml --offline $(SET_ARGS); \
70+
echo "--------- controlplane and worker template rendering complete ---------"; \
71+
rm -rf "$$TMPDIR"

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,13 @@ talm -n 1.2.3.4 -e 1.2.3.4 template -t templates/controlplane.yaml -i > nodes/no
5858

5959
If you are testing template rendering you can pass the flag --offline. Also using the --full flag will generate a complete configuration, usefull for testing proper rendering of the templates.
6060
```bash
61-
talm template -t templates/controlplane.yaml --full -i > nodes/cp1.yaml --offline
62-
talm template -t templates/worker.yaml --full -i > nodes/worker1.yaml --offline
61+
talm template -t templates/controlplane.yaml --offline --full -i > nodes/cp1.yaml
62+
talm template -t templates/worker.yaml --offline --full -i > nodes/worker1.yaml
63+
```
64+
65+
To develop and extend templates capabilities of talm you can use make render-template to render templates offline and check the output:
66+
```bash
67+
make render-template SET_ARGS="--set kubespan=false --full"
6368
```
6469

6570
Edit `nodes/node1.yaml` file:

0 commit comments

Comments
 (0)