diff --git a/pkg/services/baremetal/remediation/remediation.go b/pkg/services/baremetal/remediation/remediation.go index 9878f2345..bb99f5bb8 100644 --- a/pkg/services/baremetal/remediation/remediation.go +++ b/pkg/services/baremetal/remediation/remediation.go @@ -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 @@ -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 } diff --git a/pkg/services/hcloud/remediation/remediation.go b/pkg/services/hcloud/remediation/remediation.go index bbd096ee0..a83cb39f8 100644 --- a/pkg/services/hcloud/remediation/remediation.go +++ b/pkg/services/hcloud/remediation/remediation.go @@ -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 } @@ -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 }