aenix-io / talm

Manage Talos Linux the GitOps Way!
Mozilla Public License 2.0
138 stars 6 forks source link

If system_disk unspecified then disk is not substituted #4

Closed kvaps closed 6 months ago

kvaps commented 6 months ago

If system_disk unspecified:

talosctl -e 192.168.88.50 -n 192.168.88.50 disks --insecure
DEV        MODEL              SERIAL   TYPE   UUID   WWID   MODALIAS      NAME   SIZE    BUS_PATH                                              SUBSYSTEM          READ_ONLY   SYSTEM_DISK
/dev/sda   VMware Virtual S   -        HDD    -      -      scsi:t-0x00   -      32 GB   /pci0000:00/0000:00:10.0/host2/target2:0:0/2:0:0:0/   /sys/class/block

this line rendered with empty string:

https://github.com/aenix-io/talm/blob/5651f91738086a7e9ad93ec535d9df32d7e3b2bc/charts/cozystack/templates/_helpers.tpl#L30

this generates errors like:

./talm apply -f nodes/srv1.yaml -i
- talm: file=nodes/srv1.yaml, nodes=[192.168.88.50], endpoints=[192.168.88.50]
error applying new configuration: rpc error: code = InvalidArgument desc = configuration validation failed: 2 errors occurred:
        * an install disk is required in "metal" mode
        * specified install disk does not exist: ""

we have to update talm.discovered.system_disk_name to provide first discovered disk by default in case if system_disk is not found:

https://github.com/aenix-io/talm/blob/5651f91738086a7e9ad93ec535d9df32d7e3b2bc/charts/talm/templates/_helpers.tpl#L1-L7