fix: pass talos endpoints during bootstrap

This commit is contained in:
eding 2026-07-20 22:05:29 +02:00
parent ea732ebded
commit d16442862e
4 changed files with 25 additions and 15 deletions

View file

@ -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
}
}

View file

@ -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 {

View file

@ -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 {

View file

@ -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
}