Skip to content

Commit 128c281

Browse files
committed
add support for nvme devices for tinkerbell provider
* change rendering of block device to respect that nvme device paths have a 'p' as a prefix Signed-off-by: soer3n <[email protected]>
1 parent a9dc4e6 commit 128c281

File tree

1 file changed

+7
-7
lines changed
  • pkg/cloudprovider/provider/baremetal/plugins/tinkerbell/client

1 file changed

+7
-7
lines changed

pkg/cloudprovider/provider/baremetal/plugins/tinkerbell/client/template.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -197,17 +197,17 @@ func createGrowPartitionAction(destDisk string) Action {
197197
Image: "quay.io/tinkerbell/actions/cexec:c5bde803d9f6c90f1a9d5e06930d856d1481854c",
198198
Timeout: 90,
199199
Environment: map[string]string{
200-
"BLOCK_DEVICE": fmt.Sprintf("{{ index .Hardware.Disks 0 }}%s", PartitionNumber),
200+
"BLOCK_DEVICE": fmt.Sprintf("{{ formatPartition ( index .Hardware.Disks 0 ) (.partition_number | int) }}"),
201201
"FS_TYPE": fsType,
202202
"CHROOT": "y",
203203
"DEFAULT_INTERPRETER": defaultInterpreter,
204-
"CMD_LINE": fmt.Sprintf("growpart %s %s && resize2fs %s%s", destDisk, PartitionNumber, destDisk, PartitionNumber),
204+
"CMD_LINE": fmt.Sprintf("growpart %s %s && resize2fs '{{ formatPartition ( index .Hardware.Disks 0 ) (.partition_number | int) }}'", destDisk, PartitionNumber),
205205
},
206206
}
207207
}
208208

209209
func createNetworkConfigAction() Action {
210-
netplaneConfig := `
210+
netplanConfig := `
211211
network:
212212
version: 2
213213
renderer: networkd
@@ -227,10 +227,10 @@ network:
227227
Image: "quay.io/tinkerbell-actions/writefile:v1.0.0",
228228
Timeout: 90,
229229
Environment: map[string]string{
230-
"DEST_DISK": fmt.Sprintf("{{ index .Hardware.Disks 0 }}%s", PartitionNumber),
230+
"DEST_DISK": fmt.Sprintf("{{ formatPartition ( index .Hardware.Disks 0 ) (.partition_number | int) }}"),
231231
"FS_TYPE": fsType,
232232
"DEST_PATH": "/etc/netplan/config.yaml",
233-
"CONTENTS": netplaneConfig,
233+
"CONTENTS": netplanConfig,
234234
"UID": "0",
235235
"GID": "0",
236236
"MODE": "0644",
@@ -252,7 +252,7 @@ echo 'local-hostname: {{.hardware_name}}' >> /var/lib/cloud/seed/nocloud/meta-da
252252
Image: "quay.io/tinkerbell-actions/cexec:v1.0.0",
253253
Timeout: 90,
254254
Environment: map[string]string{
255-
"BLOCK_DEVICE": fmt.Sprintf("{{ index .Hardware.Disks 0 }}%s", PartitionNumber),
255+
"BLOCK_DEVICE": fmt.Sprintf("{{ formatPartition ( index .Hardware.Disks 0 ) (.partition_number | int) }}"),
256256
"FS_TYPE": fsType,
257257
"CHROOT": "y",
258258
"DEFAULT_INTERPRETER": defaultInterpreter,
@@ -267,7 +267,7 @@ func decodeCloudInitFile(hardwareName string) Action {
267267
Image: "quay.io/tinkerbell/actions/cexec:latest",
268268
Timeout: 90,
269269
Environment: map[string]string{
270-
"BLOCK_DEVICE": fmt.Sprintf("{{ index .Hardware.Disks 0 }}%s", PartitionNumber),
270+
"BLOCK_DEVICE": fmt.Sprintf("{{ formatPartition ( index .Hardware.Disks 0 ) (.partition_number | int) }}"),
271271
"FS_TYPE": fsType,
272272
"CHROOT": "y",
273273
"DEFAULT_INTERPRETER": "/bin/sh -c",

0 commit comments

Comments
 (0)