Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,18 @@ import-internal:
talos-$(TALOS_VERSION)/internal/pkg
rm -rf internal/app/init/ internal/pkg/rng/ internal/pkg/tui/
sed -i 's|github.com/siderolabs/talos/internal|github.com/cozystack/talm/internal|g' `grep -rl 'github.com/siderolabs/talos/internal' internal`

render-template: build
@echo "Rendering templates..."; \
TALM_PATH="`pwd`/talm"; \
TMPDIR="`mktemp -d -t talm-tmp.XXXXXX`"; \
echo "Initializing template workspace in $$TMPDIR..."; \
cd "$$TMPDIR"; \
if [ ! -x "$$TALM_PATH" ]; then echo "Error: '$$TALM_PATH' not found or not executable."; exit 127; fi; \
"$$TALM_PATH" init --preset cozystack; \
echo; echo "--------- Rendering controlplane.yaml template ---------"; \
"$$TALM_PATH" template -t templates/controlplane.yaml --offline $(SET_ARGS); \
echo; echo "--------- Rendering worker.yaml template ---------"; \
"$$TALM_PATH" template -t templates/worker.yaml --offline $(SET_ARGS); \
echo "--------- controlplane and worker template rendering complete ---------"; \
rm -rf "$$TMPDIR"
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,17 @@ Gather node information:
talm -n 1.2.3.4 -e 1.2.3.4 template -t templates/controlplane.yaml -i > nodes/node1.yaml
```

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.
```bash
talm template -t templates/controlplane.yaml --offline --full -i > nodes/cp1.yaml
talm template -t templates/worker.yaml --offline --full -i > nodes/worker1.yaml
```

To develop and extend templates capabilities of talm you can use make render-template to render templates offline and check the output:
```bash
make render-template SET_ARGS="--set kubespan=false --full"
```

Edit `nodes/node1.yaml` file:
```yaml
# talm: nodes=["1.2.3.4"], endpoints=["1.2.3.4"], templates=["templates/controlplane.yaml"]
Expand Down
8 changes: 6 additions & 2 deletions charts/cozystack/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ machine:
network:
hostname: {{ include "talm.discovered.hostname" . | quote }}
nameservers: {{ include "talm.discovered.default_resolvers" . }}
{{- if .Values.kubespan }}
kubespan:
enabled: true
{{- end }}
{{- (include "talm.discovered.physical_links_info" .) | nindent 4 }}
interfaces:
{{- $existingInterfacesConfiguration := include "talm.discovered.existing_interfaces_configuration" . }}
Expand Down Expand Up @@ -85,7 +89,7 @@ cluster:
controlPlane:
endpoint: "{{ .Values.endpoint }}"
{{- if eq .MachineType "controlplane" }}
allowSchedulingOnControlPlanes: true
allowSchedulingOnControlPlanes: {{ if eq .Values.allowSchedulingOnControlPlanes false }}false{{ else }}true{{ end }}
controllerManager:
extraArgs:
bind-address: 0.0.0.0
Expand All @@ -108,7 +112,7 @@ cluster:
proxy:
disabled: true
discovery:
enabled: false
enabled: {{ .Values.kubespan }}
etcd:
advertisedSubnets:
{{- toYaml .Values.advertisedSubnets | nindent 6 }}
Expand Down
2 changes: 1 addition & 1 deletion charts/cozystack/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ serviceSubnets:
advertisedSubnets:
- 192.168.100.0/24
oidcIssuerUrl: ""
certSANs: []
certSANs: []
4 changes: 4 additions & 0 deletions charts/generic/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ machine:
network:
hostname: {{ include "talm.discovered.hostname" . | quote }}
nameservers: {{ include "talm.discovered.default_resolvers" . }}
{{- if .Values.kubespan }}
kubespan:
enabled: true
{{- end }}
{{- (include "talm.discovered.physical_links_info" .) | nindent 4 }}
interfaces:
{{- $existingInterfacesConfiguration := include "talm.discovered.existing_interfaces_configuration" . }}
Expand Down
2 changes: 1 addition & 1 deletion charts/generic/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ serviceSubnets:
- 10.96.0.0/16
advertisedSubnets:
- 192.168.100.0/24
certSANs: []
certSANs: []
18 changes: 12 additions & 6 deletions pkg/generated/presets.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ machine:
network:
hostname: {{ include "talm.discovered.hostname" . | quote }}
nameservers: {{ include "talm.discovered.default_resolvers" . }}
{{- if .Values.kubespan }}
kubespan:
enabled: true
{{- end }}
{{- (include "talm.discovered.physical_links_info" .) | nindent 4 }}
interfaces:
{{- $existingInterfacesConfiguration := include "talm.discovered.existing_interfaces_configuration" . }}
Expand Down Expand Up @@ -115,7 +119,7 @@ cluster:
controlPlane:
endpoint: "{{ .Values.endpoint }}"
{{- if eq .MachineType "controlplane" }}
allowSchedulingOnControlPlanes: true
allowSchedulingOnControlPlanes: {{ if eq .Values.allowSchedulingOnControlPlanes false }}false{{ else }}true{{ end }}
controllerManager:
extraArgs:
bind-address: 0.0.0.0
Expand All @@ -138,7 +142,7 @@ cluster:
proxy:
disabled: true
discovery:
enabled: false
enabled: {{ .Values.kubespan }}
etcd:
advertisedSubnets:
{{- toYaml .Values.advertisedSubnets | nindent 6 }}
Expand All @@ -162,8 +166,7 @@ serviceSubnets:
advertisedSubnets:
- 192.168.100.0/24
oidcIssuerUrl: ""
certSANs: []
`,
certSANs: []`,
"generic/Chart.yaml": `apiVersion: v2
name: %s
type: application
Expand Down Expand Up @@ -208,6 +211,10 @@ machine:
network:
hostname: {{ include "talm.discovered.hostname" . | quote }}
nameservers: {{ include "talm.discovered.default_resolvers" . }}
{{- if .Values.kubespan }}
kubespan:
enabled: true
{{- end }}
{{- (include "talm.discovered.physical_links_info" .) | nindent 4 }}
interfaces:
{{- $existingInterfacesConfiguration := include "talm.discovered.existing_interfaces_configuration" . }}
Expand Down Expand Up @@ -259,8 +266,7 @@ serviceSubnets:
- 10.96.0.0/16
advertisedSubnets:
- 192.168.100.0/24
certSANs: []
`,
certSANs: []`,
"talm/Chart.yaml": `apiVersion: v2
type: library
name: %s
Expand Down