Skip to content

Commit

Permalink
fix(elbv2/target): Retry registration if target is unused
Browse files Browse the repository at this point in the history
Fixes #1458

Signed-off-by: Maximilian Blatt <[email protected]>
(external expert on behalf of DB Netz AG)
  • Loading branch information
MisterMX committed Oct 17, 2022
1 parent 9825b1f commit 9cada9d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions apis/elbv2/manualv1alpha1/target.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,13 @@ func (s *TargetObservation) GetState() string {
return ""
}

func (s *TargetObservation) GetReason() string {
if s.TargetHealth != nil && s.TargetHealth.Reason != nil {
return *s.TargetHealth.Reason
}
return ""
}

// TargetStatus defines the observed state of a
// Target
type TargetStatus struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/elbv2/target/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func (e *external) Observe(ctx context.Context, mg resource.Managed) (managed.Ex
}

return managed.ExternalObservation{
ResourceExists: true,
ResourceExists: cr.Status.AtProvider.GetReason() != string(types.TargetHealthReasonEnumNotRegistered),
ResourceUpToDate: true, // Targets cannot be updated
}, nil
}
Expand Down

0 comments on commit 9cada9d

Please sign in to comment.