-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Delete bindings when deleting a service instance #2150
Conversation
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.
It's still possible to delete the service instance... It just won't complete until the bindings are deleted as well. Do we want to block it completely in the UI or just warn?
}; | ||
|
||
if (CatalogService.SERVICE_CATALOG_ENABLED) { | ||
DataService.list(resource, context, function (bindings) { |
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 believe everywhere we call this, we already have a list of the bindings. I'd rather just pass those in if we have them.
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.
The service instance page does not have the bindings. I can take them optionally and only retrieve if not given.
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.
The service instance page does not have the bindings.
Hey @jeff-phillips-18 I'm OK with it in that case.
I want to look at the instance page anyway later. It looks like it's requesting service classes twice, and that's potentially a lot of data.
In general, I think it's better for the page controllers to get the data and pass them down to the components to avoid requesting things more than once.
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 can take a look at that as part of this. Basically its the ResourceServiceBindings that gets the bindings for the service instance page (an all the 'application' pages. I can update that logic as well if you'd like.
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.
It might be better to wait for #2155 since I have some changes to instance page and resource service bindings component in flight :/
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.
Pushed changes to only get bindings when not passed. Holding off on updating all the controllers using the ResourceServiceBindings.
}); | ||
}; | ||
|
||
var deprovision = function (apiObject) { |
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 realize this isn't new, but I'd rather call the parameter serviceInstance
because the function is very specific to instances. apiObject
sounds like any object.
app/views/modals/warning.html
Outdated
<div class="modal-resource-action"> | ||
<div class="modal-body"> | ||
<h1> | ||
<span class="pficon pficon-warning-triangle-o"></span> |
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.
<span class="pficon pficon-warning-triangle-o" aria-hidden="true"></span>
<span class="sr-only">warning</span>
// TODO - remove once this is resolved https://github.com/kubernetes-incubator/service-catalog/issues/942 | ||
var opts = { | ||
propagationPolicy: null | ||
}; |
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.
Not related to this PR, but we should double-check that this isn't needed for bindings as well. Right now we're using delete-link
for bindings and in some cases and not passing propogationPolicy: null
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.
Disregard, looks like we are handling it: https://github.com/openshift/origin-web-console/blob/master/app/scripts/directives/deleteLink.js#L153
resolve: { | ||
modalConfig: function() { | ||
return { | ||
title: "Unable to Deprovision", |
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.
We call the action "Delete" in the UI, so I'd be consistent in the messages we use (in the dialog and notifications).
Do we want to check if binding has a deletion timestamp? Otherwise you will have to wait for all the bindings to be deleted from the system completely before deleting the service instance, which could take a while depending on the broker. I'd rather be able to to mark everything deleted once and let it finish whenever it's done. I'm starting to think it should just be a warning and not block. |
The original idea was to block the user from deleting until the bindings had been deleted, but I'm not sure we considered the possibility that deleting the bindings could take some time. I think it would be a better experience to allow users to delete the bindings from that dialog, rather than just telling them to go do it. The bindings would be then marked for deletion and the deprovision could go ahead as @spadgett suggested. Maybe something like this? Related but probably outside of this scope, should we even be showing things that are marked for deletion in the UI? I know it doesn't work this way in practice, but deleting seems like an action that should be able to happen more or less instantaneously. Do users need to care about things they deleted but which are just hanging around waiting for the system to delete them? |
That "delete all bindings" checkbox should probably say "delete all
bindings for $service"
…On Sat, Sep 23, 2017 at 10:20 AM Cameron Britt ***@***.***> wrote:
The original idea was to block the user from deleting until the bindings
had been deleted, but I'm not sure we considered the possibility that
deleting the bindings could take some time.
I think it would be a better experience to allow users to delete the
bindings from that dialog, rather than just telling them to go do it. The
bindings would be then marked for deletion and the deprovision could go
ahead as @spadgett <https://github.com/spadgett> suggested. Maybe
something like this?
[image: screen shot 2017-09-23 at 10 10 15 am]
<https://user-images.githubusercontent.com/8974593/30773885-eaae6878-a047-11e7-9032-ffec12a740f3.png>
Related but probably outside of this scope, should we even be showing
things that are marked for deletion in the UI? I know it doesn't work this
way in practice, but deleting seems like an action that should be able to
happen more or less instantaneously. Do users need to care about things
they deleted but which are just hanging around waiting for the system to
delete them?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2150 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AIjxASIzWiTUxFs8QzOLUKV3p1vhUjPZks5slRO4gaJpZM4PhUkh>
.
|
@ncameronbritt How about the title? |
@ncameronbritt @spadgett How about something like: |
@spadgett and I were just talking about this. I think the best experience is to simply delete the bindings for the user. Deleting the service will also delete any deployments created by the service, and there's no reason for the user to think that bindings needed to be treated in a special way, and a binding doesn't have any value without the service. Maybe it makes sense to add a sentence like we have here: "$service and its data will no longer be available to your application." |
b5dcf95
to
5cdf111
Compare
Works for me. I would probably change "It cannot be undone" to "This cannot be undone." And in the sentence before it should be "your applications". |
This is in the delete utility code (been there for a while). I can change it, but it would change for most deletion confirmation dialogs. @ncameronbritt Please advise. |
5cdf111
to
4f5479b
Compare
@spadgett Also added checks to not show the "no bindable services" message when the object is either a service instance or it is marked for deletion. Removed the "Create Binding" link when the object is marked for deletion. |
var resource = { | ||
group: 'servicecatalog.k8s.io', | ||
resource: 'serviceinstancecredentials' | ||
}; |
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.
We should probably start switching to
var resource = APIService.getPreferredVersion('serviceinstancecredentials');
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.
fixed
var resource = { | ||
group: 'servicecatalog.k8s.io', | ||
resource: 'serviceinstances' | ||
}; |
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.
var resource = APIService.getPreferredVersion('serviceinstances');
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.
fixed
var resource = { | ||
group: 'servicecatalog.k8s.io', | ||
resource: 'serviceinstancecredentials' | ||
}; |
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.
var resource = APIService.getPreferredVersion('serviceinstancecredentials');
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.
fixed
}); | ||
} | ||
|
||
return deferred.promise; |
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.
You can just return the promise from DataService.list
instead of creating your own deferred.
return DataService.list(resource, context, function (serviceBindings) {
bindings = serviceBindings.by('metadata.name');
return BindingService.getBindingsForResource(bindings, apiObject);
});
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.
@spadgett What comes back from the promise is not the bindings manipulated by the callback function. Maybe I'm doing something else wrong?
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.
Sorry my JS was wrong:
return DataService.list(resource, context).then(function(serviceBindings) {
bindings = serviceBindings.by('metadata.name');
return BindingService.getBindingsForResource(bindings, apiObject);
});
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.
Ah yes, that makes sense. Sorry, I should have seen that.
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.
Fixed. Thanks @spadgett
|
||
getBindingsIfNecessary(apiObject, bindings).then(function(serviceBindings) { | ||
_.each(serviceBindings, function (binding) { | ||
if (!binding.metadata.deletionTimestamp) { |
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.
This is a style nit, but I personally find early returns easier to reason about.
if (binding.metadata.deletionTimestamp) {
// The binding is already marked for deletion.
return;
}
// <code to delete the binding>
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.
fixed
@jeff-phillips-18 I don't feel that strongly about "this" vs. "it", so if it's going to change a bunch of other stuff, I'd say leave it as is for now, and we can address the language change taking into account all of the different contexts in which it occurs later, if we feel like we need to. |
4f5479b
to
fda31b5
Compare
fda31b5
to
1056510
Compare
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.
Thanks @jeff-phillips-18 looks good
[merge] |
Evaluated for origin web console merge up to 1056510 |
Origin Web Console Merge Results: SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_request_origin_web_console/272/) (Base Commit: b92abe5) (PR Branch Commit: 1056510) |
Fixes #2149