{"action":"created","issue":{"url":"https://api.github.com/repos/kubernetes-incubator/service-catalog/issues/39","repository_url":"https://api.github.com/repos/kubernetes-incubator/service-catalog","labels_url":"https://api.github.com/repos/kubernetes-incubator/service-catalog/issues/39/labels{/name}","comments_url":"https://api.github.com/repos/kubernetes-incubator/service-catalog/issues/39/comments","events_url":"https://api.github.com/repos/kubernetes-incubator/service-catalog/issues/39/events","html_url":"https://github.com/kubernetes-incubator/service-catalog/issues/39","id":190472240,"number":39,"title":"Create consensus on unbind","user":{"login":"pmorie","id":366488,"avatar_url":"https://avatars.githubusercontent.com/u/366488?v=3","gravatar_id":"","url":"https://api.github.com/users/pmorie","html_url":"https://github.com/pmorie","followers_url":"https://api.github.com/users/pmorie/followers","following_url":"https://api.github.com/users/pmorie/following{/other_user}","gists_url":"https://api.github.com/users/pmorie/gists{/gist_id}","starred_url":"https://api.github.com/users/pmorie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pmorie/subscriptions","organizations_url":"https://api.github.com/users/pmorie/orgs","repos_url":"https://api.github.com/users/pmorie/repos","events_url":"https://api.github.com/users/pmorie/events{/privacy}","received_events_url":"https://api.github.com/users/pmorie/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-11-19T02:59:03Z","updated_at":"2016-11-22T02:50:46Z","closed_at":null,"body":"In the F2F meetings in Boulder and Seattle, we made significant progress on the provision/bind workflow.  We still need to explore the API flows for unbind and deprovision.  Some quick thoughts:\r\n\r\n#### Indicating intention to unbind-or deprovision\r\n\r\nThe current precedent for this type of thing in kubernetes is to delete the resource to release it.  For example, to unbind a PV from a PVClaim, you delete the claim.  Here's a wrinkle for our specific situation: in the PV/PVC domain, you have something to reconcile against (the PV) if your controller misses the PVC delete.  However, in the scenario of a controller missing the delete event for a `Binding`, there is nothing to reconcile against a priori.  So, this seems to indicate that we need to have a way to preserve the `Binding` resource until we can be sure it is fully deleted and unbound at the broker.  The pattern we have for _this_ in Kubernetes is called 'finalization'.\r\n\r\n#### Why finalization is needed - unbind example\r\n\r\nLet's assume you have a `Binding` B to an `Instance` I of a `ServiceClass` S.  There are a few permutations to talk through, but I'll keep it simple for now.  Imagine the following:\r\n\r\n1.  The consumer wants to unbind B, so they delete B.\r\n2.  The controller receives a delete event for B and issues a DELETE to `/v2/service_instances/:instance_id/service_bindings/:binding_id`\r\n\r\nFrom here it gets a little tricky -- do you allow the delete of B to happen, even if the broker doesn't respond with a 200?  Here's where finalization comes in.  The REST API for deleting a binding will instead of fully deleting the object manipulate the status in a way that indicates that the object is in a 'unbinding' condition.  There are a vast number of details to understanding finalization, which I will gloss over here for brevity and ease of understanding.  Essentially, part of a namespaces spec is the remaining finalizers that must run for the namespace to be fully deleted.  When the first delete request happens, the namespace's status is updated to reflect the finalizing condition, and various controllers go to work deleting resources and updating the list of finalizers to remove themselves as they complete their work.  There is a namespace controller that handles doing the final delete once the list of finalizers is empty, and the REST API only allows a 'full' delete of a namespace once that list is empty.  We can leverage a similar pattern here to allow the following:\r\n\r\n1.  The consumer wants to unbind B and makes a delete request to the service catalog API server to do so.\r\n2.  The REST API updates B's status to reflect that it is deleting\r\n3.  The controller continues calling delete at the broker until receiving a 200\r\n4.  When the controller is satisfied that the delete at the broker succeeded, it can update B in a way that indicates that the finalization is complete, then delete B.\r\n\r\n#### Deleting services / secrets / SIPs after unbinding\r\n\r\nWhen a binding is undone, the resources created from that binding should be deleted.  This should be implemented by a controller doing another part of finalization.\r\n"},"comment":{"url":"https://api.github.com/repos/kubernetes-incubator/service-catalog/issues/comments/262133406","html_url":"https://github.com/kubernetes-incubator/service-catalog/issues/39#issuecomment-262133406","issue_url":"https://api.github.com/repos/kubernetes-incubator/service-catalog/issues/39","id":262133406,"user":{"login":"pmorie","id":366488,"avatar_url":"https://avatars.githubusercontent.com/u/366488?v=3","gravatar_id":"","url":"https://api.github.com/users/pmorie","html_url":"https://github.com/pmorie","followers_url":"https://api.github.com/users/pmorie/followers","following_url":"https://api.github.com/users/pmorie/following{/other_user}","gists_url":"https://api.github.com/users/pmorie/gists{/gist_id}","starred_url":"https://api.github.com/users/pmorie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pmorie/subscriptions","organizations_url":"https://api.github.com/users/pmorie/orgs","repos_url":"https://api.github.com/users/pmorie/repos","events_url":"https://api.github.com/users/pmorie/events{/privacy}","received_events_url":"https://api.github.com/users/pmorie/received_events","type":"User","site_admin":false},"created_at":"2016-11-22T02:50:46Z","updated_at":"2016-11-22T02:50:46Z","body":"@arschles \r\n\r\n> Has a decision been made on what happens to existing Bindings when a deletion/finalization is made on an Instance?\r\n\r\nNot at all.  I'm about to create an issue for it."}}
{"actor":{"display_login":"pmorie"}}