Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upmake deprovisioning an instance asynchronously not fall-through to synchronous deprovision #1067
Conversation
k8s-ci-robot
added
the
cncf-cla: yes
label
Jul 26, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
@pmorie Yup, working on that now! |
arschles
added
the
in-progress
label
Jul 27, 2017
kibbles-n-bytes
removed
the
in-progress
label
Jul 31, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
kibbles-n-bytes
Aug 1, 2017
Contributor
I made a few design choices, would like feedback as to whether they're valid.
Currently in master, asynchronously deprovisioning sets an async-only condition, and then falls back onto the regular deprovision logic, where the condition is set as successfully deprovisioned, a successful deprovision event is recorded, and the finalizer is cleared.
This seemed strange to me. The instance hasn't actually been completely prepped for K8s-side deletion, so clearing the finalizer seems wrong. And setting the InstanceConditionReady as false already occurs in the async-only step, so doing a second condition seemed odd. And I'm not entirely sure of when it's appropriate to record an event, but recording a successful deprovision event also seemed misleading. So I added a return in the async section that does none of them. Is this alright? Should we be recording a different event type here?
|
I made a few design choices, would like feedback as to whether they're valid. Currently in master, asynchronously deprovisioning sets an async-only condition, and then falls back onto the regular deprovision logic, where the condition is set as successfully deprovisioned, a successful deprovision event is recorded, and the finalizer is cleared. This seemed strange to me. The instance hasn't actually been completely prepped for K8s-side deletion, so clearing the finalizer seems wrong. And setting the |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
kibbles-n-bytes
Aug 1, 2017
Contributor
It seems like async provisioning does record an event, so I'll record one for deprovisioning too.
|
It seems like async provisioning does record an event, so I'll record one for deprovisioning too. |
kibbles-n-bytes
referenced this pull request
Aug 1, 2017
Merged
Only do work for instances from a single queue #1074
kibbles-n-bytes
changed the title from
make deprovisioning an instance asynchronously add it to the polling queue
to
make deprovisioning an instance asynchronously not fall-through
Aug 1, 2017
kibbles-n-bytes
changed the title from
make deprovisioning an instance asynchronously not fall-through
to
make deprovisioning an instance asynchronously not fall-through to synchronous deprovision
Aug 1, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
kibbles-n-bytes
Aug 1, 2017
Contributor
Since #1074 is now in, the scope of this PR changes. Now it is only preventing the asynchronous deprovision logic from falling through to the rest of the synchronous deprovision logic, and adds a test (and typo fix).
|
Since #1074 is now in, the scope of this PR changes. Now it is only preventing the asynchronous deprovision logic from falling through to the rest of the synchronous deprovision logic, and adds a test (and typo fix). |
MHBauer
approved these changes
Aug 2, 2017
seems okay.
I am not liking this "gotta make sure we check in the right order".
LGTM
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
kibbles-n-bytes
Aug 2, 2017
Contributor
@MHBauer Not sure if there's a clean way around it. There's no single thing you can look at to see what should be done to reconcile the instance. We could specify the different actions to take as:
shouldPoll = instance.Status.AsyncOpInProgress
shouldDelete = !instance.Status.AsyncOpInProgress && instance.ObjectMeta.DeletionTimestamp != nil
shouldAddOrUpdate = !instance.StatusAsyncOpInProgress && instance.ObjectMeta.DeletionTimestamp == nil
But that's pretty ugly IMO. I'm planning to work on refactoring the polling queue logic anyway though, so I'll try to see if there's a better place we can place the poll/not poll logic at least. But that'll have to be in a followup.
|
@MHBauer Not sure if there's a clean way around it. There's no single thing you can look at to see what should be done to reconcile the instance. We could specify the different actions to take as:
But that's pretty ugly IMO. I'm planning to work on refactoring the polling queue logic anyway though, so I'll try to see if there's a better place we can place the poll/not poll logic at least. But that'll have to be in a followup. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
MHBauer
Aug 2, 2017
Member
That's why I keep trying to push this state machine idea. We should know, coming in, which fork we're going down, and go down only that fork, before moving to the next state. I'm not sure if it can be done by sub parts of the condition or what. What makes the controller adjustments painful is we have to make sure to return if we enter one of these blocks, make sure to change something (or not) so we don't enter the same block the next go around, make sure sure that nothing in one block can effect any other block in the same invocation, etc. Maybe extracting will fix it. I don't know.
|
That's why I keep trying to push this state machine idea. We should know, coming in, which fork we're going down, and go down only that fork, before moving to the next state. I'm not sure if it can be done by sub parts of the condition or what. What makes the controller adjustments painful is we have to make sure to return if we enter one of these blocks, make sure to change something (or not) so we don't enter the same block the next go around, make sure sure that nothing in one block can effect any other block in the same invocation, etc. Maybe extracting will fix it. I don't know. |
| @@ -354,22 +358,21 @@ func (c *controller) reconcileInstance(instance *v1alpha1.Instance) error { | ||
| glog.V(4).Infof("Processing Instance %v/%v", instance.Namespace, instance.Name) | ||
| // if the instance is marked for deletion, handle that first. | ||
| if instance.Status.AsyncOpInProgress { |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
pmorie
Aug 3, 2017
Member
if you move this up to L328, we can remove a level of nesting in the checksum check
pmorie
Aug 3, 2017
Member
if you move this up to L328, we can remove a level of nesting in the checksum check
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
kibbles-n-bytes
Aug 7, 2017
Contributor
@MHBauer Can you write up an issue describing a bit of what your state machine concept would look like? I'm curious and would like to wrap my head around it, so if you're serious about it I'd like to get the ball rolling so we can discuss pros/cons/implementation/etc.
|
@MHBauer Can you write up an issue describing a bit of what your state machine concept would look like? I'm curious and would like to wrap my head around it, so if you're serious about it I'd like to get the ball rolling so we can discuss pros/cons/implementation/etc. |
MHBauer
added
the
LGTM1
label
Aug 9, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
kibbles-n-bytes
added
the
LGTM2
label
Aug 11, 2017
kibbles-n-bytes
merged commit 8411f31
into
kubernetes-incubator:master
Aug 11, 2017
kibbles-n-bytes
deleted the
kibbles-n-bytes:async-fix
branch
Aug 11, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
nilebox
Aug 21, 2017
Member
@kibbles-n-bytes just found this bug myself, and was happy to find that it has already been fixed in the latest release :)
|
@kibbles-n-bytes just found this bug myself, and was happy to find that it has already been fixed in the latest release :) |
kibbles-n-bytes commentedJul 26, 2017
•
edited
No description provided.