Skip to content

Commit

Permalink
fix(clustertool): correct issue with single-node apply not being correct
Browse files Browse the repository at this point in the history
  • Loading branch information
PrivatePuffin committed Nov 6, 2024
1 parent 29c2b80 commit cc83134
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion clustertool/pkg/gencmd/apply.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package gencmd

import (
"os"
"path/filepath"
"strings"

Expand All @@ -25,7 +26,19 @@ func GenApply(node string, extraArgs []string) []string {
commands = append(commands, cmd)
}
} else {
cmd := talosPath + " " + "apply-config" + " --talosconfig " + helper.TalosConfigFile + " -n " + node + " " + strings.Join(extraArgs, " ")
nodename := ""
for _, noderef := range talassist.TalConfig.Nodes {
if noderef.IPAddress == node {
nodename = noderef.Hostname
}
}
if nodename == "" {
log.Error().Msgf("Node IP %s, does not match any node in talconfig. Exiting...", node)
os.Exit(1)
}

filename := talassist.TalConfig.ClusterName + "-" + nodename + ".yaml"
cmd := talosPath + " " + "apply-config" + " --talosconfig " + helper.TalosConfigFile + " -n " + node + " -f " + filepath.Join(helper.TalosGenerated, filename) + " " + strings.Join(extraArgs, " ")
commands = append(commands, cmd)
}
log.Debug().Msgf("Apply Commands rendered: %s", commands)
Expand Down

0 comments on commit cc83134

Please sign in to comment.