Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions controller/machine/hardware.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,18 +279,6 @@ func (scope *machineReconcileScope) releaseHardware(hw *tinkv1.Hardware) error {
delete(hw.ObjectMeta.Labels, HardwareOwnerNameLabel)
delete(hw.ObjectMeta.Labels, HardwareOwnerNamespaceLabel)
delete(hw.ObjectMeta.Annotations, HardwareProvisionedAnnotation)
/*
// setting the AllowPXE=true indicates to Smee that this hardware should be allowed
// to netboot. FYI, this is not authoritative.
// Other hardware values can be set to prohibit netbooting of a machine.
// See this Boots function for the logic around this:
// https://github.com/tinkerbell/smee/blob/main/internal/ipxe/script/ipxe.go#L112
for _, ifc := range hw.Spec.Interfaces {
if ifc.Netboot != nil {
ifc.Netboot.AllowPXE = ptr.To(true)
}
}
*/

controllerutil.RemoveFinalizer(hw, infrastructurev1.MachineFinalizer)

Expand Down
22 changes: 21 additions & 1 deletion controller/machine/scope.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,30 @@ func (scope *machineReconcileScope) DeleteMachineWithDependencies() error {
scope.log.Info("Removing machine", "hardwareName", scope.tinkerbellMachine.Spec.HardwareName)
// Fetch hw for the machine.
hw := &tinkv1.Hardware{}
if err := scope.getHardwareForMachine(hw); err != nil {

err := scope.getHardwareForMachine(hw)
if err != nil && !apierrors.IsNotFound(err) {
return err
}

// If the Hardware is not found, we can't do any BMC operations. In this case we just remove all
// the other dependencies and remove the finalizer from the TinkerbellMachine object so that it can be deleted.
if apierrors.IsNotFound(err) {
scope.log.Info("Hardware not found, only template, workflow and finalizer will be removed",
"hardwareName", scope.tinkerbellMachine.Spec.HardwareName,
)

if err := scope.removeTemplate(); err != nil && !apierrors.IsNotFound(err) {
return fmt.Errorf("removing Template: %w", err)
}

if err := scope.removeWorkflow(); err != nil && !apierrors.IsNotFound(err) {
return fmt.Errorf("removing Workflow: %w", err)
}

return scope.removeFinalizer()
}

if err := scope.removeDependencies(hw); err != nil {
return err
}
Expand Down
Loading