11# Makefile for managing Talos environment
22
33TALOS_ARCH = $(shell go env GOHOSTARCH)
4- TALOS_VERSION = $(shell talosctl version --client --short | awk '{print $$NF}' | tail -n 1)
4+ TALOS_VERSION ? = $(shell talosctl version --client --short | awk '{print $$NF}' | tail -n 1)
55TALOS_IMAGE_DIR ?= /var/lib/talos
6- TALOS_IMAGE_URL = https://github.com/siderolabs/talos/releases/download/$(TALOS_VERSION ) /metal-$(TALOS_ARCH ) .iso
6+
7+ # generated image download link by Talos Linux Image Factory https://factory.talos.dev/
8+ # customization:
9+ # extraKernelArgs:
10+ # - talos.network.interface.ignore=enp0s5f1
11+ TALOS_IMAGE_URL = https://factory.talos.dev/image/9ecea35ddd146528c1d742aab47e680a1f1137a93fc7bab55edc1afee125a658/$(TALOS_VERSION ) /metal-$(TALOS_ARCH ) .iso
712TALOS_IMAGE_ISO = $(TALOS_VERSION ) -metal-$(TALOS_ARCH ) .iso
813TALOS_IMAGE_PATH = $(TALOS_IMAGE_DIR ) /$(TALOS_IMAGE_ISO )
914
@@ -65,7 +70,7 @@ talos-registry-mirror:
6570.PHONY : talos-prepare-images
6671talos-prepare-images : talos-registry-mirror
6772 @echo " >>> Preparing Talos images..."
68- @for image in $$(talosctl image default | grep -v flannel ) ; do \
73+ @for image in ghcr.io/siderolabs/installer: $( TALOS_VERSION ) $$(talosctl image default | grep -v flannel ) ; do \
6974 if echo " $$ image" | grep -q kube; then \
7075 image=$$(echo $$image | sed -e 's/:v\([[:digit:]]\+\.\ ) \{ 2\} [[:digit:]]\+ $$ /:v$(TALOS_K8S_VERSION ) /' ); \
7176 fi ; \
@@ -87,7 +92,7 @@ talos-libvirt-init: talos-libvirt-clean
8792 @if [ ! -f " $( TALOS_IMAGE_PATH) " ]; then \
8893 sudo mkdir -p " $( TALOS_IMAGE_DIR) " && \
8994 sudo chmod 777 " $( TALOS_IMAGE_DIR) " && \
90- echo " >>> Downloading Talos image $( TALOS_IMAGE_ISO ) into $( TALOS_IMAGE_DIR) ..." && \
95+ echo " >>> Downloading Talos image $( TALOS_IMAGE_URL ) into $( TALOS_IMAGE_DIR) ..." && \
9196 wget " $( TALOS_IMAGE_URL) " --quiet -O " $( TALOS_IMAGE_PATH) " && \
9297 echo " >>> Talos image downloaded." ; \
9398 fi
@@ -172,14 +177,14 @@ talos-apply-config-%:
172177 echo " >>>>>> Applying Talos control plane configuration to $$ {node}..." ; \
173178 ip=$$(sudo virsh domifaddr --full "$${node}" | grep -w vnet0 | grep -iw ipv4 | awk '{print $$NF}' | awk -F/ '{print $$1}' ) ; \
174179 ip_family=$* cluster=$(TALOS_CLUSTER_NAME ) node=$$ {node} jinjanate talos/machine-config.yaml.j2 -o talos/machine-config.yaml && \
175- talosctl apply-config --insecure --nodes $$ {ip} --file talos/controlplane.yaml --config-patch " @talos/machine-config.yaml" ; \
180+ talosctl apply-config --insecure --nodes $$ {ip} --file talos/controlplane.yaml --config-patch " @talos/machine-config.yaml" || exit 1 ; \
176181 echo " >>>>>> Talos control plane configuration applied to $$ {node}." ; \
177182 done
178183 @sudo virsh list --name | grep ' ^$(TALOS_WORKER_NODE)' | while read node; do \
179184 echo " >>>>>> Applying Talos worker configuration to $$ {node}..." ; \
180185 ip=$$(sudo virsh domifaddr --full "$${node}" | grep -w vnet0 | grep -iw ipv4 | awk '{print $$NF}' | awk -F/ '{print $$1}' ) ; \
181186 ip_family=$* cluster=$(TALOS_CLUSTER_NAME ) node=$$ {node} jinjanate talos/machine-config.yaml.j2 -o talos/machine-config.yaml && \
182- talosctl apply-config --insecure --nodes $$ {ip} --file talos/worker.yaml --config-patch " @talos/machine-config.yaml" ; \
187+ talosctl apply-config --insecure --nodes $$ {ip} --file talos/worker.yaml --config-patch " @talos/machine-config.yaml" || exit 1 ; \
183188 echo " >>>>>> Talos worker configuration applied to $$ {node}." ; \
184189 done
185190 @$(MAKE ) talos-libvirt-wait-address-$(TALOS_ENDPOINT_IP_FAMILY )
@@ -257,6 +262,10 @@ talos-init-%: talos-libvirt-init talos-prepare-images talos-apply-config-%
257262.PHONY : talos-init
258263talos-init : talos-init-ipv4
259264
265+ .PHONY : talos-init-single
266+ talos-init-single :
267+ @TALOS_WORKER_COUNT=0 $(MAKE ) talos-init
268+
260269.PHONY : talos-clean
261270talos-clean : talos-libvirt-clean
262271 @echo " >>> Deleting Talos registry mirror..."
0 commit comments