-
Notifications
You must be signed in to change notification settings - Fork 382
Cascading binding deletion #2711
Cascading binding deletion #2711
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: piotrmiskiewicz The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
How to test: Install the test-broker:
and register it in the service-catalog:
Create a namespace: Create an instance
Create 3 bindings:
Then, delete the instance:
check events:
|
04c89ba
to
c607665
Compare
The PR implements service bindings deletion in the controller due to a business requirement - deprovision must be done after all unbind operations. |
9f31d40
to
5f5e7ce
Compare
OMG, this is part of the matrix of deleting things! #2229 |
/retest |
I still want to discuss that in details
The current solution is not backward compatible and user cannot select different strategies for different ServiceInstance. With current impl you enable/disable it globally. Let's discuss that if we want to implement this feature in that way. /hold |
There is a feature flag which enables cascading deletion, so the change is backward compatible. The ownerReference cannot be used because of a problem when the delete is done with propagationPolicy=background. The binding must be deleted before the instance. The risk is someone could do |
so it's not backward compatible because you cannot remove that feature flag and make that behavior as the core one because u will change the deletion policy for all clients when they will update to new service catalog version. I'm talking about the let's discuss that offline and post here clear strategy for having that feature in ServiceCatalog:) |
docs/feature-gates.md
Outdated
@@ -32,6 +32,7 @@ different Service Catalog. | |||
| `ResponseSchema` | `false` | Alpha | v0.1.12 | | | |||
| `ServicePlanDefaults` | `false` | Alpha | v0.1.32 | | | |||
| `UpdateDashboardURL` | `false` | Alpha | v0.1.13 | | | |||
| `CascadingDeletion` | ` false` | Alpha | v0.2.3 | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `CascadingDeletion` | ` false` | Alpha | v0.2.3 | | | |
| `CascadingDeletion` | ` false` | Alpha | v0.3.0 | | |
bindingLister := c.bindingLister.ServiceBindings(instance.Namespace) | ||
|
||
selector := labels.NewSelector() | ||
bindingList, err := bindingLister.List(selector) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just inline all of those statements:
c.bindingLister.ServiceBindings(instance.Namespace).List(labels.NewSelector())
klog.V(4).Infof("Delete existing bindings for the instance %s", instance.Name) | ||
bindings, err := c.listExistingBindings(instance) | ||
if err != nil { | ||
return err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
u're missing context for each error
e.g. here u should have
errors.Wrapf(err, "while fetching ServiceBindings for instance %s", instance.Name)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added wrapping errors
also, adjust the chart with the new param that can be set by our clients |
41086a1
to
64dbea6
Compare
/test pull-build-all-images-for-s390x |
@piotrmiskiewicz you probably missed this comment #2711 (comment). The Helm Chart is still not adjusted, please add opt to enable it, sth similar what we have already: https://github.com/kubernetes-sigs/service-catalog/blob/master/charts/catalog/values.yaml#L105-L106 |
6924d6a
to
db932a7
Compare
/test pull-service-catalog-test-migration |
just add more info can be found here: #2734 |
/test pull-service-catalog-test-integration |
charts/catalog/values.yaml
Outdated
@@ -82,6 +82,8 @@ controllerManager: | |||
serviceAccount: service-catalog-controller-manager | |||
# Whether the controller will expose metrics on /metrics | |||
enablePrometheusScrape: false | |||
# Whether the cascading binding deletion is disabled, it overrides the CascadingDeletion feature gate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the double feature gate? i dont really understand how this is supposed to work if I set one and not the other.
so, i can't seem to get this to work. I set the "cascadingDeletionEnabled" flag to true, and leave the "cascadingDeletionDisabled" to false, as it's a negative, which should make this work? these flags are confusing. why do we not just have a single top level flag like the other feature gates? I go to deprovision the instance, and it gets stuck in the "DeprovisionBlockedByExistingCredentials" state. I'm using 'svcat' for this, btw. |
As I understand the process, the feature gate will be removed in the future and the feature will be enabled by default. The second (disabling) flag is designed for all users which does not want this feature and it should be set explicitly. Long term the feature gate will be removed and the cascading deletion will be enabled by default. There will be only the cascadingDeletionDisabled flag. Currently, the cascading deletion feature is an alpha feature. This is the reason to use a feature gate. |
I've made a mistake in the chart, which I've just fixed. |
why do we not leave the to-be-used-in-the-future-flag out of the chart now, and add it it later, then? I also think the double negative is weird, wouldn't it make more sense to make it --enable-foobar and set it to true by default? |
I understand that two options may be confusing, at the beginning I had only the feature gate. |
you can leave the option on the actual controller itself, although I would prefer it was a simple "enable-feature-foobar" flag rather than a weird double-negative one. I'm just saying take the ability to set it out of the helm charts so people don't get confused about why there's two settings that look like they do the same thing. |
We want to have the cascading deletion feature enabled by default in the future. Sounds good, but the problem is we are adding such feature without an alpha stage and this feature breaks the backward compatibility. |
425023a
to
ee78615
Compare
de9f93f
to
e786c49
Compare
/retest |
e786c49
to
52d7f45
Compare
I removed the "disabling" flag. Now, there is only enabling flag |
/lgtm |
/hold cancel |
Implements proposal: #2734
Adds a cascading deletion feature which deletes existing service bindings for a service instance which is being deleted.
Which issue(s) this PR fixes
Fixes: #481 kyma-project/kyma#5180