-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathboot-to-talos-userdata.yaml
More file actions
59 lines (50 loc) · 2.22 KB
/
boot-to-talos-userdata.yaml
File metadata and controls
59 lines (50 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#cloud-config
write_files:
- path: /opt/boot-to-talos.sh
permissions: '0755'
content: |
#!/bin/bash
set -euo pipefail
echo "🚀 Starting boot-to-Talos transition..."
# Install Docker for image operations
apt-get update
apt-get install -y docker.io
systemctl start docker
# Configure Docker to use registry caches (critical - no direct internet from private subnets)
mkdir -p /etc/docker
cat > /etc/docker/daemon.json << 'DOCKER_EOF'
{
"registry-mirrors": ["http://10.10.1.100:5054"],
"insecure-registries": ["10.10.1.100:5054"]
}
DOCKER_EOF
systemctl restart docker
# Pull custom Talos image via GHCR registry cache (port 5054)
echo "📦 Pulling custom Talos image via bastion cache: 10.10.1.100:5054"
echo "🔍 Image: ghcr.io/urmanac/cozystack-assets/talos:demo-stable"
# Test if image is accessible
docker pull "ghcr.io/urmanac/cozystack-assets/talos:demo-stable" || {
echo "❌ Failed to pull ghcr.io/urmanac/cozystack-assets/talos:demo-stable"
echo "🔍 Testing registry cache connectivity..."
curl -v http://10.10.1.100:5054/v2/ || true
exit 1
}
echo "✅ Successfully pulled ghcr.io/urmanac/cozystack-assets/talos:demo-stable"
# Extract Talos kernel and initramfs for kexec
echo "🔍 Extracting Talos kernel and initramfs..."
docker create --name talos-extract "ghcr.io/urmanac/cozystack-assets/talos:demo-stable"
# Find and extract boot files from the Talos image
# This is a simplified approach - actual implementation may vary
docker cp talos-extract:/boot /tmp/talos-boot/ 2>/dev/null || {
echo "⚠️ /boot not found, looking for kernel files elsewhere..."
docker run --rm "ghcr.io/urmanac/cozystack-assets/talos:demo-stable" find / -name "*vmlinuz*" -o -name "*initramfs*" || true
}
docker rm talos-extract
# Transition to Talos (kexec)
echo "🎯 Transitioning to Talos..."
# Implementation depends on specific Talos image structure
# This would invoke kexec with Talos kernel and initramfs
echo "Boot-to-Talos preparation complete"
runcmd:
- /opt/boot-to-talos.sh
final_message: "Ubuntu → Talos transition initiated"