feat: add cloud-init Go parser (Phase 2)
Implement a lightweight cloud-init system for first-boot configuration: - Go parser for YAML config (hostname, network, KubeSolo settings) - Static/DHCP network modes with DNS override - KubeSolo extra flags and API server SAN configuration - Portainer Edge Agent and air-gapped deployment support - New init stage 45-cloud-init.sh runs before network/hostname stages - Stages 50/60 skip gracefully when cloud-init has already applied - Build script compiles static Linux/amd64 binary (~2.7 MB) - 17 unit tests covering parsing, validation, and example files - Full documentation at docs/cloud-init.md Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,15 @@
|
||||
#!/bin/sh
|
||||
# 60-hostname.sh — Set system hostname
|
||||
# If cloud-init (stage 45) already set the hostname, skip this stage.
|
||||
|
||||
# Cloud-init writes /etc/hostname and saves to data partition
|
||||
if [ "$CLOUDINIT_APPLIED" = "1" ] && [ -f /etc/hostname ]; then
|
||||
HOSTNAME="$(cat /etc/hostname)"
|
||||
if [ -n "$HOSTNAME" ]; then
|
||||
log "Hostname already set by cloud-init: $HOSTNAME"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f "$DATA_MOUNT/etc-kubesolo/hostname" ]; then
|
||||
HOSTNAME="$(cat "$DATA_MOUNT/etc-kubesolo/hostname")"
|
||||
|
||||
Reference in New Issue
Block a user