Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporarily disable OOB machine conditions #115

Merged
merged 1 commit into from
Jun 13, 2024
Merged
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
47 changes: 24 additions & 23 deletions internal/controller/oob_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1165,29 +1165,30 @@ func (r *OOBReconciler) runCtrlPhase(ctx context.Context, machine *metalv1alpha1
return advance && machineApply == nil, requeueAfter, nil
}

func (r *OOBReconciler) setMachineCondition(ctx context.Context, machine *metalv1alpha1.Machine, machineApply *metalv1alpha1apply.MachineApplyConfiguration, machineStatus *metalv1alpha1apply.MachineStatusApplyConfiguration, advance bool, requeueAfter time.Duration, cond metav1.Condition) (context.Context, *metalv1alpha1apply.MachineApplyConfiguration, *metalv1alpha1apply.MachineStatusApplyConfiguration, bool, time.Duration, error) {
conds, mod := ssa.SetCondition(machine.Status.Conditions, cond)
if mod {
if machineStatus == nil {
applyst, err := metalv1alpha1apply.ExtractMachineStatus(machine, OOBFieldManager)
if err != nil {
return ctx, nil, nil, false, 0, fmt.Errorf("cannot extract Machine status: %w", err)
}
machineStatus = util.Ensure(applyst.Status)
}

log.Debug(ctx, "Setting Machine condition", "type", cond.Type, "status", cond.Status, "reason", cond.Reason)
machineStatus.Conditions = nil
for _, c := range conds {
ca := metav1apply.Condition().
WithType(c.Type).
WithStatus(c.Status).
WithLastTransitionTime(c.LastTransitionTime).
WithReason(c.Reason).
WithMessage(c.Message)
machineStatus = machineStatus.WithConditions(ca)
}
}
func (r *OOBReconciler) setMachineCondition(ctx context.Context, _ *metalv1alpha1.Machine, machineApply *metalv1alpha1apply.MachineApplyConfiguration, machineStatus *metalv1alpha1apply.MachineStatusApplyConfiguration, advance bool, requeueAfter time.Duration, _ metav1.Condition) (context.Context, *metalv1alpha1apply.MachineApplyConfiguration, *metalv1alpha1apply.MachineStatusApplyConfiguration, bool, time.Duration, error) {
// TODO: Investigate condition ownership semantics before reenabling this code.
//conds, mod := ssa.SetCondition(machine.Status.Conditions, cond)
//if mod {
// if machineStatus == nil {
// applyst, err := metalv1alpha1apply.ExtractMachineStatus(machine, OOBFieldManager)
// if err != nil {
// return ctx, nil, nil, false, 0, fmt.Errorf("cannot extract Machine status: %w", err)
// }
// machineStatus = util.Ensure(applyst.Status)
// }
//
// log.Debug(ctx, "Setting Machine condition", "type", cond.Type, "status", cond.Status, "reason", cond.Reason)
// machineStatus.Conditions = nil
// for _, c := range conds {
// ca := metav1apply.Condition().
// WithType(c.Type).
// WithStatus(c.Status).
// WithLastTransitionTime(c.LastTransitionTime).
// WithReason(c.Reason).
// WithMessage(c.Message)
// machineStatus = machineStatus.WithConditions(ca)
// }
//}
return ctx, machineApply, machineStatus, advance, requeueAfter, nil
}

Expand Down