Skip to content
This repository has been archived by the owner on May 6, 2022. It is now read-only.

Commit

Permalink
Update service instance delete to handle timeout error from contactin…
Browse files Browse the repository at this point in the history
…g the broker
  • Loading branch information
Tara Gu committed Apr 28, 2019
1 parent 72b631e commit c302a23
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ func (c *controller) getAuthCredentialsFromClusterServiceBroker(broker *v1beta1.
BearerConfig: bearerConfig,
}, nil
}
return nil, fmt.Errorf("empty auth info or unsupported auth mode: %s", authInfo)
return nil, fmt.Errorf("empty auth info or unsupported auth mode: %v", authInfo)
}

// getAuthCredentialsFromServiceBroker returns the auth credentials, if any, or
Expand Down Expand Up @@ -752,7 +752,7 @@ func (c *controller) getAuthCredentialsFromServiceBroker(broker *v1beta1.Service
BearerConfig: bearerConfig,
}, nil
}
return nil, fmt.Errorf("empty auth info or unsupported auth mode: %s", authInfo)
return nil, fmt.Errorf("empty auth info or unsupported auth mode: %v", authInfo)
}

func getBasicAuthConfig(secret *corev1.Secret) (*osb.BasicAuthConfig, error) {
Expand Down
11 changes: 11 additions & 0 deletions pkg/controller/controller_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"net/url"
"sync"
"time"
"strings"

osb "github.com/pmorie/go-open-service-broker-client/v2"
"k8s.io/klog"
Expand Down Expand Up @@ -937,6 +938,16 @@ func (c *controller) reconcileServiceInstanceDelete(instance *v1beta1.ServiceIns
`Error deprovisioning, %s at ClusterServiceBroker %q: %v`,
prettyName, brokerName, err,
)
// If this is a timeout error, that means we have difficulty contacting the broker, we should
// still mark the instance as deleted in this case
if strings.Contains(err.Error(), "connect: connection timed out") {
klog.V(4).Info(pcb.Message("DeprovisionInstance call errored because of timeout; still process deprovision as successful"))
if response.Async {
return c.processDeprovisionAsyncResponse(instance, response)
}
return c.processDeprovisionSuccess(instance)
}

if httpErr, ok := osb.IsHTTPError(err); ok {
msg = fmt.Sprintf("Deprovision call failed; received error response from broker: %v", httpErr)
}
Expand Down

0 comments on commit c302a23

Please sign in to comment.