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

ignore transient error during polling #430

Merged
merged 2 commits into from
May 12, 2024
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
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
Loading