Skip to content

Commit

Permalink
fix: add k3s overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
bohdand-weka committed Jan 3, 2024
1 parent 854361b commit 8186e03
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions internal/local/k3s/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,29 @@ type InstallConfig struct {
}

func (c InstallConfig) k3sInstallArgs() string {
k3sArgs := []string{
fmt.Sprintf("--node-ip=%s", c.NodeIP),
fmt.Sprintf("--flannel-iface=%s", c.Iface),
fmt.Sprintf("--default-local-storage-path=%s", defaultLocalStoragePath),
var args = map[string]string{
"--node-ip": c.NodeIP,
"--flannel-iface": c.Iface,
"--default-local-storage-path": defaultLocalStoragePath,
}

if len(c.ExternalIPs) > 0 {
k3sArgs = append(k3sArgs, fmt.Sprintf("--node-external-ip=%s", strings.Join(c.ExternalIPs, ",")))
k3sArgs = append(k3sArgs, fmt.Sprintf("--tls-san=%s", strings.Join(c.ExternalIPs, ",")))
args["--node-external-ip"] = strings.Join(c.ExternalIPs, ",")
args["--tls-san"] = strings.Join(c.ExternalIPs, ",")
}

return strings.Join(k3sArgs, " ")
// override args if overrides exists
for k, v := range c.Configuration.K3SArgs {
args[k] = v
}

var str strings.Builder

for k, v := range args {
_, _ = str.WriteString(fmt.Sprintf("%s=%s ", k, v))
}

return str.String()
}

// Install runs K3S installation process
Expand Down

0 comments on commit 8186e03

Please sign in to comment.