Bug 1540819 - Failed to unbind after deleting templateinstance with servicebinding existing
Summary: Failed to unbind after deleting templateinstance with servicebinding existing
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Service Broker
Version: 3.9.0
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: ---
: 3.9.0
Assignee: Ben Parees
QA Contact: XiuJuan Wang
URL:
Whiteboard:
: 1535171 1538370 (view as bug list)
Depends On:
Blocks: 1543039 1543044
TreeView+ depends on / blocked
 
Reported: 2018-02-01 05:25 UTC by XiuJuan Wang
Modified: 2021-06-10 14:25 UTC (History)
13 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: Unbinding a template service instance throws an error if the template service instance was deleted. Consequence: It becomes impossible to unbind a service instance if the template service instance was manually deleted, including if the project containing the TSI was deleted. Fix: The template service broker will return success/gone in cases where the unbind refers to a non-existent template service instance. Result: The unbind can proceed even if the TSI no longer exists.
Clone Of:
: 1543039 1543044 (view as bug list)
Environment:
Last Closed: 2018-06-27 18:01:32 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2018:2013 0 None None None 2018-06-27 18:02:05 UTC

Description XiuJuan Wang 2018-02-01 05:25:12 UTC
Description of problem:
When servicebinding exist, deleteing templateinstance will conduct the unbind operation failed. The failed reason is that the related templateinstance not found.
It's better to prompt message like serviceinstance behavior "Delete instance blocked by existing ServiceBindings associated with this instance.  All credentials must be removed first" when delete templateinstance with servicebinding existing

Version-Release number of selected component (if applicable):

Server https://***:443
openshift v3.9.0-0.34.0
kubernetes v1.9.1+a0ce1bc65

How reproducible:
alwyas

Steps to Reproduce:
1.Priovision a mongodb serviceclass from browse catalog
2.Create a binding
3.After serviceinstance and servicebinding ready, deprovision templateinstance
4.Unbind the servicebinding


Actual results:
4.Servicebinding will be marked as deletion
$oc get servicebinding mongodb-ephemeral-fgl2f-bdg6r -o yaml 
<----------------snip---------------->
status:
  conditions:
  - lastTransitionTime: 2018-02-01T02:51:43Z
    message: 'Unbind call failed. Error unbinding from ServiceInstance "xiu3/mongodb-ephemeral-fgl2f"
      of ClusterServiceClass (K8S: "9321a362-062c-11e8-9135-fa163eac540c" ExternalName:
      "mongodb-ephemeral") at ClusterServiceBroker "template-service-broker": Status:
      500; ErrorMessage: <nil>; Description: templateinstances.template.openshift.io
      "eaaf751e-4118-4473-8cd8-b505243bcdea" not found; ResponseError: <nil>'
    reason: UnbindCallFailed
    status: Unknown
    type: Ready
  - lastTransitionTime: 2018-02-01T02:51:43Z
    message: 'Unbind call failed. Error unbinding from ServiceInstance "xiu3/mongodb-ephemeral-fgl2f"
      of ClusterServiceClass (K8S: "9321a362-062c-11e8-9135-fa163eac540c" ExternalName:
      "mongodb-ephemeral") at ClusterServiceBroker "template-service-broker": Status:
      500; ErrorMessage: <nil>; Description: templateinstances.template.openshift.io
      "eaaf751e-4118-4473-8cd8-b505243bcdea" not found; ResponseError: <nil>'
    reason: UnbindCallFailed
    status: "True"
    type: Failed
<-------------snip----------------->


Expected results:
Should prompt warning for deleting tempalteinstance when serivicebinding exist

Additional info:

Comment 2 Ben Parees 2018-02-01 22:45:20 UTC
I don't foresee us prompting the user to prevent them from deleting a templateinstance that has bindings (though if we did, that would be a web console thing, so maybe an RFE should be opened against it.  you'd still always be able to just "oc delete" it though and we're never going to prevent that).

As for the behavior of the TSB's unbind operation, when the template instance in question no longer exists, I suspect the TSB is "working as designed" here, but I defer to Paul Morie if he thinks the TSB should return some other response on the unbind request.

Jim Minter may have some insight as to the expected/intended/agreed upon behavior also, so adding him to the CC.

Marking low severity as you have to semi-intentionally get yourself in this situation.

Comment 3 Ben Parees 2018-02-01 22:48:48 UTC
(I think we're hitting this codepath:
https://github.com/openshift/origin/blob/ddd1f926d749c914e479b2c54e385137a99873c2/pkg/templateservicebroker/servicebroker/unbind.go#L48

it's possible we should explicitly check for IsNotFound(err) on the templateinstance lookup and just return a StatusGone message if we get one, will double check w/ Jim when he gets back, or if Paul has insight)

Comment 4 Ben Parees 2018-02-06 21:22:52 UTC
*** Bug 1535171 has been marked as a duplicate of this bug. ***

Comment 5 openshift-github-bot 2018-02-07 00:33:02 UTC
Commit pushed to master at https://github.com/openshift/origin

https://github.com/openshift/origin/commit/495739248a10c95768b0a743ad0e7fcf34ef04db
Merge pull request #18416 from bparees/tsb_binding

Automatic merge from submit-queue.

return gone on unbind from non-existent templateinstance

bug 1540819

https://bugzilla.redhat.com/show_bug.cgi?id=1540819

Comment 8 Jeff Peeler 2018-02-08 17:05:52 UTC
*** Bug 1538370 has been marked as a duplicate of this bug. ***

Comment 9 XiuJuan Wang 2018-02-13 01:59:48 UTC
The fix has merged into ocp v3.9.0-0.42.0.
And can't reproduce this bug. Please help set to on_qa when you are free

Comment 10 XiuJuan Wang 2018-02-13 02:50:40 UTC
As comment #9, move this bug to verified

Comment 18 errata-xmlrpc 2018-06-27 18:01:32 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2018:2013


Note You need to log in before you can comment on or make changes to this bug.