Skip to content

Commit

Permalink
Add more event about owner remediated condition
Browse files Browse the repository at this point in the history
Signed-off-by: Aniruddha Basak <[email protected]>
  • Loading branch information
aniruddha2000 committed Oct 18, 2023
1 parent 92ee94c commit c9d3614
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion pkg/services/baremetal/remediation/remediation.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,13 @@ func (s *Service) remediate(ctx context.Context, host infrav1.HetznerBareMetalHo
record.Warn(s.scope.BareMetalRemediation, "FailedAddingRebootAnnotation", err.Error())
return fmt.Errorf("failed to add reboot annotation: %w", err)
}
record.Event(s.scope.BareMetalRemediation, "AnnotationAdded", "Reboot annotation is added to the BareMetalHost")

if err := patchHelper.Patch(ctx, &host); err != nil {
return fmt.Errorf("failed to patch: %s %s/%s %w", host.Kind, host.Namespace, host.Name, err)
}

record.Event(s.scope.BareMetalRemediation, "AnnotationAdded", "Reboot annotation is added to the BareMetalHost")

// update status of BareMetalRemediation object
now := metav1.Now()
s.scope.BareMetalRemediation.Status.LastRemediated = &now
Expand All @@ -193,6 +194,7 @@ func (s *Service) handlePhaseWaiting(ctx context.Context) (res reconcile.Result,
record.Warn(s.scope.BareMetalRemediation, "FailedSettingConditionOnMachine", err.Error())
return res, err
}
record.Event(s.scope.BareMetalRemediation, "SetOwnerRemediatedCondition", "exit remediation because owner remediated condition was set on machine")

return res, nil
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/services/hcloud/remediation/remediation.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (s *Service) Reconcile(ctx context.Context) (res reconcile.Result, err erro
record.Warn(s.scope.HCloudRemediation, "FailedSettingConditionOnMachine", err.Error())
return res, fmt.Errorf("failed to set conditions on CAPI machine: %w", err)
}
record.Warn(s.scope.HCloudRemediation, "FailedToFindServer", "Server doesn't exist")
record.Warn(s.scope.HCloudRemediation, "ExitRemediation", "exit remediation because bare metal server does not exist")
return res, nil
}

Expand Down Expand Up @@ -152,6 +152,7 @@ func (s *Service) handlePhaseWaiting(ctx context.Context) (res reconcile.Result,
record.Warn(s.scope.HCloudRemediation, "FailedSettingConditionOnMachine", err.Error())
return res, fmt.Errorf("failed to set conditions on CAPI machine: %w", err)
}
record.Event(s.scope.HCloudRemediation, "SetOwnerRemediatedCondition", "exit remediation because owner remediated condition was set on machine")

return res, nil
}
Expand Down

0 comments on commit c9d3614

Please sign in to comment.