Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(elbv2/target): Retry registration if target is unused #1464

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion apis/elbv2/manualv1alpha1/target.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ type TargetObservation struct {
TargetHealth *TargetHealth `json:"targetHealth,omitempty"`
}

// GetState returns TargetHealth.State if it is not nil, otherwise an empty
// GetState returns s.TargetHealth.State if it is not nil, otherwise an empty
// string.
func (s *TargetObservation) GetState() string {
if s.TargetHealth != nil && s.TargetHealth.State != nil {
Expand All @@ -194,6 +194,15 @@ func (s *TargetObservation) GetState() string {
return ""
}

// GetReason returns s.TargetHealth.Reason if it is not nil, otherwise an empty
// string.
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