Skip to content

Commit a0b46d2

Browse files
rsmittytalos-bot
authored andcommitted
fix: ensure proper ordering of packet machine config handling
This PR fixes a small bug where, when using configPatches, we weren't injecting the `#!/bin/talos` string to the top of the machine config if we were uisng Packet/Equinix. Signed-off-by: Spencer Smith <[email protected]>
1 parent 3a7c38e commit a0b46d2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

controllers/talosconfig_controller.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,6 @@ func (r *TalosConfigReconciler) Reconcile(req ctrl.Request) (_ ctrl.Result, rerr
192192
return ctrl.Result{}, errors.New("unknown generate type specified")
193193
}
194194

195-
// Packet acts a fool if you don't prepend #!talos to the userdata
196-
// so we try to suss out if that's the type of machine getting created.
197-
if machine.Spec.InfrastructureRef.Kind == "PacketMachine" {
198-
retData.BootstrapData = "#!talos\n" + retData.BootstrapData
199-
}
200-
201195
// Handle patches to the machine config if they were specified
202196
// Note this will patch both pre-generated and user-provided configs.
203197
if len(config.Spec.ConfigPatches) > 0 {
@@ -219,6 +213,12 @@ func (r *TalosConfigReconciler) Reconcile(req ctrl.Request) (_ ctrl.Result, rerr
219213
retData.BootstrapData = string(patchedBytes)
220214
}
221215

216+
// Packet acts a fool if you don't prepend #!talos to the userdata
217+
// so we try to suss out if that's the type of machine getting created.
218+
if machine.Spec.InfrastructureRef.Kind == "PacketMachine" {
219+
retData.BootstrapData = "#!talos\n" + retData.BootstrapData
220+
}
221+
222222
err = r.writeBootstrapData(ctx, tcScope, []byte(retData.BootstrapData))
223223
if err != nil {
224224
return ctrl.Result{}, err

0 commit comments

Comments
 (0)