Skip to content

Commit

Permalink
Update feature status on failed apply (#601)
Browse files Browse the repository at this point in the history
Update feature status on failed apply
  • Loading branch information
HomayoonAlimohammadi authored Aug 12, 2024
1 parent 5031a2d commit afca21c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/k8s/pkg/k8sd/controllers/feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,14 @@ func (c *FeatureController) reconcile(
return fmt.Errorf("failed to retrieve cluster configuration: %w", err)
}

if featureStatus, err := apply(cfg); err != nil {
return fmt.Errorf("failed to apply configuration: %w", err)
} else if err := updateFeatureStatus(ctx, featureStatus); err != nil {
return fmt.Errorf("failed to update feature status: %w", err)
status, applyErr := apply(cfg)
if err := updateFeatureStatus(ctx, status); err != nil {
// NOTE (hue): status update errors are not returned but only logged. we might need some retry logic in the future.
log.FromContext(ctx).WithValues("message", status.Message, "applied-successfully", applyErr == nil).Error(err, "Failed to update feature status")
}

if applyErr != nil {
return fmt.Errorf("failed to apply configuration: %w", applyErr)
}

return nil
Expand Down

0 comments on commit afca21c

Please sign in to comment.