Skip to content

Commit

Permalink
Add warn event for capi machine condition adding
Browse files Browse the repository at this point in the history
Signed-off-by: Aniruddha Basak <[email protected]>
  • Loading branch information
aniruddha2000 committed Oct 17, 2023
1 parent 291176e commit 92ee94c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/services/baremetal/remediation/remediation.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (s *Service) Reconcile(ctx context.Context) (res reconcile.Result, err erro
record.Warn(s.scope.BareMetalRemediation, "FailedSettingConditionOnMachine", err.Error())
return res, err
}
record.Eventf(s.scope.BareMetalRemediation, "ExitRemediation", "exit remediation because bare metal machine has no host annotation")
record.Event(s.scope.BareMetalRemediation, "ExitRemediation", "exit remediation because bare metal machine has no host annotation")
return res, nil
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/services/hcloud/remediation/remediation.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ func (s *Service) Reconcile(ctx context.Context) (res reconcile.Result, err erro
s.scope.HCloudRemediation.Status.Phase = infrav1.PhaseDeleting

if err := s.setOwnerRemediatedCondition(ctx); err != nil {
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")
return res, nil
}

Expand Down Expand Up @@ -147,6 +149,7 @@ func (s *Service) handlePhaseWaiting(ctx context.Context) (res reconcile.Result,
s.scope.HCloudRemediation.Status.Phase = infrav1.PhaseDeleting

if err := s.setOwnerRemediatedCondition(ctx); err != nil {
record.Warn(s.scope.HCloudRemediation, "FailedSettingConditionOnMachine", err.Error())
return res, fmt.Errorf("failed to set conditions on CAPI machine: %w", err)
}

Expand Down

0 comments on commit 92ee94c

Please sign in to comment.