Skip to content

Commit

Permalink
🌱Add condition indicating deletion timestamp is set
Browse files Browse the repository at this point in the history
🌱Fix lint errors

🌱Fix gofmt lint error

🐛Fix condition

🌱Remove Deletion condition

🐛Fix condition errors

🌱Remove condition and split if statements

🐛Fix lint error and remove needsUpdate

🌱Remove if statement

🌱Move set condition outside the switch

Add being deleted condition in host

🌱Remove deleting condition from reconcileSelectedStates method

🌱Minor change

🌱Revert changes made to hbmh controller

🌱Change severity
  • Loading branch information
yrs147 committed May 22, 2024
1 parent c7b4e05 commit 43696e1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions api/v1beta1/conditions_const.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,11 @@ const (
HostAssociateFailedReason = "HostAssociateFailed"
)

const (
// DeletionInProgressReason indicates that a host is being deleted.
DeletionInProgressReason = "DeletionInProgress"
)

// deprecated conditions.

const (
Expand Down
11 changes: 10 additions & 1 deletion pkg/services/baremetal/host/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,23 @@ func (s *Service) Reconcile(ctx context.Context) (result reconcile.Result, err e

oldHost := s.scope.HetznerBareMetalHost.DeepCopy()

if !s.scope.HetznerBareMetalHost.DeletionTimestamp.IsZero() {
conditions.MarkFalse(
s.scope.HetznerBareMetalHost,
infrav1.HostReadyCondition,
infrav1.DeletionInProgressReason,
clusterv1.ConditionSeverityWarning,
"Host is not ready because it is being deleted",
)
}

hostStateMachine := newHostStateMachine(s.scope.HetznerBareMetalHost, s, s.scope.Logger)

defer func() {
// remove deprecated conditions
conditions.Delete(s.scope.HetznerBareMetalHost, infrav1.DeprecatedHetznerBareMetalHostReadyCondition)
conditions.Delete(s.scope.HetznerBareMetalHost, infrav1.DeprecatedHostProvisionSucceededCondition)
conditions.Delete(s.scope.HetznerBareMetalHost, infrav1.DeprecatedRateLimitExceededCondition)

conditions.SetSummary(s.scope.HetznerBareMetalHost)

// save host if it changed during reconciliation
Expand Down

0 comments on commit 43696e1

Please sign in to comment.