From d16442862e77b8af5895a82951776f6505375974 Mon Sep 17 00:00:00 2001 From: eding Date: Mon, 20 Jul 2026 22:05:29 +0200 Subject: [PATCH] fix: pass talos endpoints during bootstrap --- internal/bootstrap/bootstrap.go | 4 ++-- internal/config/config.go | 6 ++++++ internal/config/types.go | 28 +++++++++++++++------------- internal/ui/wizard.go | 2 ++ 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/internal/bootstrap/bootstrap.go b/internal/bootstrap/bootstrap.go index f38c9a0..ea49436 100644 --- a/internal/bootstrap/bootstrap.go +++ b/internal/bootstrap/bootstrap.go @@ -61,10 +61,10 @@ func (r Runner) Run() error { } } if r.Config.Talos.AutoBootstrap { - if err := utils.RunCommandInDir(generatedDir, "talosctl", "bootstrap", "--talosconfig=./clusterconfig/talosconfig", "--nodes="+r.Config.Talos.BootstrapNode); err != nil { + if err := utils.RunCommandInDir(generatedDir, "talosctl", "bootstrap", "--talosconfig=./clusterconfig/talosconfig", "--endpoints="+r.Config.Talos.BootstrapEndpoint, "--nodes="+r.Config.Talos.BootstrapNode); err != nil { return err } - if err := utils.RunCommandInDir(generatedDir, "talosctl", "kubeconfig", "--talosconfig=./clusterconfig/talosconfig", "--nodes="+r.Config.Talos.KubeconfigNode, "."); err != nil { + if err := utils.RunCommandInDir(generatedDir, "talosctl", "kubeconfig", "--talosconfig=./clusterconfig/talosconfig", "--endpoints="+r.Config.Talos.KubeconfigEndpoint, "--nodes="+r.Config.Talos.KubeconfigNode, "."); err != nil { return err } } diff --git a/internal/config/config.go b/internal/config/config.go index 260d791..d53eb08 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -78,6 +78,12 @@ func applyDefaults(cfg *Config) { if cfg.Talos.Image.Architecture == "" { cfg.Talos.Image.Architecture = "amd64" } + if cfg.Talos.BootstrapEndpoint == "" { + cfg.Talos.BootstrapEndpoint = cfg.Talos.BootstrapNode + } + if cfg.Talos.KubeconfigEndpoint == "" { + cfg.Talos.KubeconfigEndpoint = cfg.Talos.KubeconfigNode + } } func Validate(cfg Config) error { diff --git a/internal/config/types.go b/internal/config/types.go index 9bcebfd..fc42338 100644 --- a/internal/config/types.go +++ b/internal/config/types.go @@ -35,19 +35,21 @@ type TemplateConfig struct { } type TalosConfig struct { - RepoDirName string `yaml:"repoDirName"` - TerraformDir string `yaml:"terraformDir"` - GeneratedDir string `yaml:"generatedDir"` - ConfigFileName string `yaml:"configFileName"` - AutoRunTerraform bool `yaml:"autoRunTerraform"` - AutoBootstrap bool `yaml:"autoBootstrap"` - AutoBootstrapFlux bool `yaml:"autoBootstrapFlux"` - BootstrapNode string `yaml:"bootstrapNode"` - KubeconfigNode string `yaml:"kubeconfigNode"` - Proxmox TalosProxmoxConfig `yaml:"proxmox"` - Cluster TalosClusterConfig `yaml:"cluster"` - Image TalosImageConfig `yaml:"image"` - Nodes []TalosNode `yaml:"nodes"` + RepoDirName string `yaml:"repoDirName"` + TerraformDir string `yaml:"terraformDir"` + GeneratedDir string `yaml:"generatedDir"` + ConfigFileName string `yaml:"configFileName"` + AutoRunTerraform bool `yaml:"autoRunTerraform"` + AutoBootstrap bool `yaml:"autoBootstrap"` + AutoBootstrapFlux bool `yaml:"autoBootstrapFlux"` + BootstrapNode string `yaml:"bootstrapNode"` + BootstrapEndpoint string `yaml:"bootstrapEndpoint"` + KubeconfigNode string `yaml:"kubeconfigNode"` + KubeconfigEndpoint string `yaml:"kubeconfigEndpoint"` + Proxmox TalosProxmoxConfig `yaml:"proxmox"` + Cluster TalosClusterConfig `yaml:"cluster"` + Image TalosImageConfig `yaml:"image"` + Nodes []TalosNode `yaml:"nodes"` } type TalosProxmoxConfig struct { diff --git a/internal/ui/wizard.go b/internal/ui/wizard.go index 56819cf..f223207 100644 --- a/internal/ui/wizard.go +++ b/internal/ui/wizard.go @@ -87,7 +87,9 @@ func RunBootstrapWizard(initial config.Config) (config.Config, error) { nodePreset := prompt(reader, "Cluster size preset (single/ha/custom)", "single") cfg.Talos.Nodes = buildNodes(reader, cfg, discovered, nodePreset) cfg.Talos.BootstrapNode = cfg.Talos.Nodes[0].Networks[0].IP + cfg.Talos.BootstrapEndpoint = cfg.Talos.BootstrapNode cfg.Talos.KubeconfigNode = cfg.Talos.Nodes[0].Networks[0].IP + cfg.Talos.KubeconfigEndpoint = cfg.Talos.KubeconfigNode return cfg, nil }