Skip to content

Commit

Permalink
feat(genconfig): allow node level installer image url
Browse files Browse the repository at this point in the history
  • Loading branch information
budimanjojo committed Oct 19, 2023
1 parent 74e104d commit 6c09821
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/docs/reference/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,18 @@ installDisk: /dev/sda
<td markdown="1" align="center">:white_check_mark:</td>
</tr>

<tr markdown="1">
<td markdown="1">`talosImageURL`</td>
<td markdown="1">string</td>
<td markdown="1">Allows for supplying the node level image used to perform the installation.<details><summary>*Show example*</summary>
```yaml
talosImageURL: factory.talos.dev/installer/e9c7ef96884d4fbc8c0a1304ccca4bb0287d766a8b4125997cb9dbe84262144e
```
</details></td>
<td markdown="1" align="center">`""`</td>
<td markdown="1" align="center">:negative_squared_cross_mark:</td>
</tr>

<tr markdown="1">
<td markdown="1">`installDiskSelector`</td>
<td markdown="1">[InstallDiskSelector](#installdiskselector)</td>
Expand Down
1 change: 1 addition & 0 deletions example/talconfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ patches:
nodes:
- hostname: kmaster1
ipAddress: 192.168.200.11
talosImageURL: factory.talos.dev/installer/e9c7ef96884d4fbc8c0a1304ccca4bb0287d766a8b4125997cb9dbe84262144e
extensions:
- image: ghcr.io/siderolabs/tailscale:1.44.0
machineFiles:
Expand Down
1 change: 1 addition & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type Node struct {
ConfigPatches []map[string]interface{} `yaml:"configPatches,omitempty"`
InlinePatch map[string]interface{} `yaml:"inlinePatch,omitempty"`
Patches []string `yaml:"patches,omitempty"`
TalosImageURL string `yaml:"talosImageURL"`
}

type cniConfig struct {
Expand Down
7 changes: 7 additions & 0 deletions pkg/talos/nodeconfig.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package talos

import (
"strings"

"github.com/budimanjojo/talhelper/pkg/config"
taloscfg "github.com/siderolabs/talos/pkg/machinery/config"
"github.com/siderolabs/talos/pkg/machinery/config/generate"
Expand Down Expand Up @@ -46,6 +48,11 @@ func GenerateNodeConfig(node *config.Node, input *generate.Input) (taloscfg.Prov
func applyNodeOverride(node *config.Node, cfg taloscfg.Provider) taloscfg.Provider {
cfg.RawV1Alpha1().MachineConfig.MachineNetwork.NetworkHostname = node.Hostname

if node.TalosImageURL != "" {
version := strings.Split(cfg.Machine().Install().Image(), ":")
cfg.RawV1Alpha1().MachineConfig.MachineInstall.InstallImage = node.TalosImageURL + ":" + version[1]
}

if len(node.Nameservers) > 0 {
cfg.RawV1Alpha1().MachineConfig.MachineNetwork.NameServers = node.Nameservers
}
Expand Down

0 comments on commit 6c09821

Please sign in to comment.