-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Controllers doesn't take any actions when being deleted. #27438
Controllers doesn't take any actions when being deleted. #27438
Conversation
@@ -671,7 +671,7 @@ func (dsc *DaemonSetsController) syncDaemonSet(key string) error { | |||
return err | |||
} | |||
dsNeedsSync := dsc.expectations.SatisfiedExpectations(dsKey) | |||
if dsNeedsSync { | |||
if dsNeedsSync && ds.DeletionTimestamp == nil { |
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'm doing this in a similar way for RC, so SGTM.
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.
For RC, I also need to check DeletionTimestamp!=nil before adopting orphaned pods. daemon controller may need to do the same.
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 amount of boilerplate is insane...
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.
Am I mistaken, or adoption is not implemented for Daemons yet?
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 where you want to set the pod's Controller ref. I mean you need to stop setting controller ref if the controller is about to be deleted. In daemon set's case, we might do it in addPod().
I'll push my changes to RC later today so I can get your comments, though it's not completed :)
a30a731
to
0b4310b
Compare
#27600 is a WIP implementation for RC. |
cc @Kargakis @pwittrock @mfojtik for deployments |
jobs LGTM |
Shouldn't we just not resync the object in case it is deleted? It's much simpler than handling DeletionTimestamp in the controller loop. |
everything := unversioned.LabelSelector{} | ||
if reflect.DeepEqual(d.Spec.Selector, &everything) { | ||
dc.eventRecorder.Eventf(d, api.EventTypeWarning, "SelectingAll", "This deployment is selecting all pods. A non-empty selector is required.") | ||
return nil | ||
} | ||
|
||
if d.Spec.Paused { | ||
if d.Spec.Paused || d.DeletionTimestamp != nil { |
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.
A deleted deployment is different from a paused deployment; these two should be separate. I think the best fix would be to stop requeueing the deployment when it is deleted.
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.
Please update this and check for the timestamp before checking for paused. #20273 changes paused deployments to do more things than simple staus updates.
@Kargakis - I'm not certain if I understand correctly what you're saying - do you mean that we shouldn't run |
I mean that we shouldn't requeue at all on deletion:
Deletions ought to be fast so I am not sure if there is any value in updating the status of an object but I may be wrong. |
@Kargakis - they won't be fast soon enough, when cascading deletion will be turned on. Before deleting object X we'll wait until all dependees are deleted, which can take some time - especially that Pods do have 30s grace period by default. |
Thanks for the line - I'll look at that part of code. |
Hm, i see. Agreed |
I didn't manage to finish this before vacation:/ Let's proceed with reviews. |
Added myself as a reviewer for Deployments. |
@janetkuo @pwittrock do you know if the deployment controller adopts existing replication controllers? Non-empty DeleteTimestamp should prevent the adoption as well. |
Yes, Deployments can adopt replica sets. |
66fec1d
to
a382c43
Compare
Deployment controller changes LGTM |
@mikedanese - can you take a look at DaemonController changes? |
a382c43
to
e1f6b08
Compare
Ping @mikedanese |
e1f6b08
to
96f1827
Compare
DaemonsetController change LGTM |
96f1827
to
0ccba0f
Compare
Squashed commit. @caesarxuchao - can you apply the final LGTM? |
@@ -289,6 +289,24 @@ func TestSufficentCapacityNodeDaemonLaunchesPod(t *testing.T) { | |||
syncAndValidateDaemonSets(t, manager, ds, podControl, 1, 0) | |||
} | |||
|
|||
// DaemonSets should place onto nodes with sufficient free resource |
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.
Could you update the comment? Or just remove it, the test name has enough information.
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.
Yikes. Thanks for noticing.
Just a nit, otherwise LGTM. |
0ccba0f
to
95de5a3
Compare
Done. @caesarxuchao PTAL |
GCE e2e build/test passed for commit 95de5a3. |
LGTM. Thanks!! |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
GCE e2e build/test passed for commit 95de5a3. |
Automatic merge from submit-queue |
I started doing it for other controllers but it's not always clear to me how it should work. I'll be adding other ones as separate commits to this PR.
cc @caesarxuchao @lavalamp