Skip to content

Commit

Permalink
ignore transient error during polling (#430)
Browse files Browse the repository at this point in the history
  • Loading branch information
kerenlahav authored May 12, 2024
1 parent 6042787 commit e457755
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion controllers/servicebinding_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ func (r *ServiceBindingReconciler) poll(ctx context.Context, serviceBinding *ser
status, statusErr := smClient.Status(serviceBinding.Status.OperationURL, nil)
if statusErr != nil {
log.Info(fmt.Sprintf("failed to fetch operation, got error from SM: %s", statusErr.Error()), "operationURL", serviceBinding.Status.OperationURL)
utils.SetFailureConditions(serviceBinding.Status.OperationType, statusErr.Error(), serviceBinding)
utils.SetInProgressConditions(ctx, serviceBinding.Status.OperationType, string(smClientTypes.INPROGRESS), serviceBinding)
freshStatus := servicesv1.ServiceBindingStatus{
Conditions: serviceBinding.GetConditions(),
}
Expand Down
4 changes: 2 additions & 2 deletions controllers/servicebinding_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1082,8 +1082,8 @@ stringData:
if err != nil {
return false
}
failedCond := meta.FindStatusCondition(createdBinding.GetConditions(), common.ConditionFailed)
return failedCond != nil && strings.Contains(failedCond.Message, "no polling for you")
cond := meta.FindStatusCondition(createdBinding.GetConditions(), common.ConditionSucceeded)
return cond != nil && strings.Contains(cond.Message, string(smClientTypes.INPROGRESS))
}, timeout, interval).Should(BeTrue())
fakeClient.UnbindReturns("", nil)
deleteAndValidate(createdBinding)
Expand Down
2 changes: 1 addition & 1 deletion controllers/serviceinstance_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ func (r *ServiceInstanceReconciler) poll(ctx context.Context, serviceInstance *s
status, statusErr := smClient.Status(serviceInstance.Status.OperationURL, nil)
if statusErr != nil {
log.Info(fmt.Sprintf("failed to fetch operation, got error from SM: %s", statusErr.Error()), "operationURL", serviceInstance.Status.OperationURL)
utils.SetInProgressConditions(ctx, serviceInstance.Status.OperationType, statusErr.Error(), serviceInstance)
utils.SetInProgressConditions(ctx, serviceInstance.Status.OperationType, string(smClientTypes.INPROGRESS), serviceInstance)
// if failed to read operation status we cleanup the status to trigger re-sync from SM
freshStatus := servicesv1.ServiceInstanceStatus{Conditions: serviceInstance.GetConditions(), ObservedGeneration: serviceInstance.Generation}
if utils.IsMarkedForDeletion(serviceInstance.ObjectMeta) {
Expand Down

0 comments on commit e457755

Please sign in to comment.