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

allow deletion of binding with incorrect service reference for #1562 implemented with Jonathan Berkhahn #1827

Closed
wants to merge 3 commits into from

Conversation

MHBauer
Copy link
Contributor

@MHBauer MHBauer commented Mar 13, 2018

Fix for #1562

if the instance is not found, print a message and proceed to success

This happens after deletion of secrets. There is no valid instance to call,
so we cannot figure out what to unbind, so the unbind call is skipped.

@jberkhahn

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 13, 2018
))
return c.processUnbindSuccess(binding)
}

msg := fmt.Sprintf(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this message still applicable now that we are explicitly handling a not found above? It seems that once you fall through to this point, the error wasn't a non-existent instance, but instead some other unspecified plumbing error that caused the retrieve to fail.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the message was ever fully correct. I'm not familiar with the errors returned by a client.

WDYT about change it to something like error getting the and try to add the err to the message? @jberkhahn

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, seems good

@n3wscott
Copy link
Contributor

Can you update the title of this PR to a real title please?

@MHBauer MHBauer changed the title for #1562 implemented with Jonathan Berkhahn allow deletion of binding with incorrect service reference for #1562 implemented with Jonathan Berkhahn Mar 13, 2018
))
return c.processUnbindSuccess(binding)
}

msg := fmt.Sprintf(
`References a non-existent %s "%s/%s"`,
pretty.ServiceInstance, binding.Namespace, binding.Spec.ServiceInstanceRef.Name,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

glog.V(5).Info(pcb.Messagef(`References a non-existent %s "%s/%s"`,
pretty.ServiceInstance, binding.Namespace, binding.Spec.ServiceInstanceRef.Name,
))
return c.processUnbindSuccess(binding)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am worried that this allows a binding to be lost if the class changes underneath the instance type temporarily.

In the very least this check needs to look at binding.Status.UnbindStatus to see if there had been a successful binding request sent to the broker before we delete this from kubernetes because otherwise this will leak a binding on the broker side even if it happens to be in a bad state at the moment.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the OSB, classes can't change. You can have a new class that's offered, but it's never related to the old one.

So if there is no reference to an instance or class, we will never be able to issue a meaningful request to the broker to delete the binding. If it's in a bad state now, how is it ever going to not be in a bad state in the future?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should throw an error instead and keep the binding in the "broken deletion" state instead of silently proceeding.

@nilebox
Copy link
Contributor

nilebox commented Mar 19, 2018

@MHBauer @jberkhahn sorry, I fail to follow the issue this PR is trying to resolve:

This happens after deletion of secrets. There is no valid instance to call

What does it mean? Why does instance deletion proceed with remaining binding, and what does it have to do with secrets? Sounds like a bug in the instance deletion logic that we try to mitigate there?

Also, would be nice to create a linked issue to discuss it there.

@jberkhahn
Copy link
Contributor

jberkhahn commented Mar 21, 2018

@nilebox
This was implemented in response to issue 1562. That might make it make a bit more sense.

MHBauer and others added 3 commits March 21, 2018 15:42
if the instance is not found, print a message and proceed to success

This happens after deletion of secrets. There is no valid instance to call,
so we cannot figure out what to unbind, so the unbind call is skipped.
- remove outdated todo
@nilebox
Copy link
Contributor

nilebox commented Mar 22, 2018

@jberkhahn invalid instance != missing instance. So I still don't get why instance is missing and binding is still there.

@nilebox
Copy link
Contributor

nilebox commented Mar 22, 2018

The only valid case of instance missing I can think of is this one:

  1. Instance is marked for deletion, but there is a Service Catalog finalizer
  2. User manually deletes the Service Catalog finalizer
  3. GC proceeds with instance deletion despite bindings not deleted

In that case, I would not handle this in the controller, or just explicitly error out instead of silently deleting. What user can do to force the deletion is to again manually remove the finalizer on a binding.

@jberkhahn
Copy link
Contributor

I have no input on the specifics of why this was needed. Perhaps @n3wscott or @kibbles-n-bytes could comment on how it's possible to enter this state?

@n3wscott
Copy link
Contributor

one example is if you delete classes/plans from k8s and force a relist from the broker. I would not expect my instances to be garbage collected by service catalog when the broker had been successfully communicated with in the past.

@MHBauer
Copy link
Contributor Author

MHBauer commented Mar 26, 2018

closing per discussion in Mar 26, 2018 service catalog meeting.

@MHBauer MHBauer closed this Mar 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants