Skip to content
This repository has been archived by the owner on Apr 29, 2020. It is now read-only.

Disable daemon set deletion behaviour #754

Merged
merged 5 commits into from
Feb 9, 2017
Merged

Conversation

rudle
Copy link
Contributor

@rudle rudle commented Feb 9, 2017

The implementation that unscheduled all pods was hard to build a failsafe
around, so we prefer to remove it altogether until we can get a proper failsafe
built.


err = waitForPodsInIntent(consulStore, 0)
err = waitForPodsInIntent(consulStore, 9)
Copy link
Collaborator

Choose a reason for hiding this comment

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

tell me about this 9... it's certainly not 11, which makes me wonder about it

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 think it should be 23

@@ -512,7 +512,8 @@ func TestFarmSchedule(t *testing.T) {
Assert(t).IsNil(err, "Expected daemon set to be deleted in farm")

// Verify node3 is unscheduled
labeled, err = waitForPodLabel(applicator, false, "node3/testPod")
// Behaviour change! Daemon Set deletions do not delete their pods (for now)
labeled, err = waitForPodLabel(applicator, true, "node3/testPod")
Assert(t).IsNil(err, "Expected pod not to have a dsID label")
Copy link
Collaborator

Choose a reason for hiding this comment

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

change expect text

The implementation that unscheduled all pods was hard to build a failsafe
around, so we prefer to remove it altogether until we can get a proper failsafe
built.
Schedule, to me, means /intent not the label tree
@rudle
Copy link
Contributor Author

rudle commented Feb 9, 2017

tests pass!

@@ -306,13 +307,14 @@ func TestSchedule(t *testing.T) {
if err != nil {
t.Fatalf("Unable to delete daemon set: %v", err)
}
numNodes = waitForNodes(t, ds, 0, desiresErrCh, dsChangesErrCh)
Assert(t).AreEqual(numNodes, 0, "took too long to unschedule")
// Behaivour change: Deleting a daemon set will no longer unschedule its pods (for now)
Copy link
Collaborator

Choose a reason for hiding this comment

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

you spelled it wrong, and I'm not talking about the ou, I'm talking about the iv

@@ -302,20 +302,22 @@ func TestSchedule(t *testing.T) {
//
// Deleting the daemon set should unschedule all of its nodes
//
// beforeDeletePods := labeledPods(t, ds)
Copy link
Collaborator

Choose a reason for hiding this comment

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

why leave this commented line in?

edit: oh hmm it gets made into a real line in next commit. oooook

ds.logger.NoFields().Info("Deleting daemon set...")
err = dsStore.Delete(ds.ID())
if err != nil {
t.Fatalf("Unable to delete daemon set: %v", err)
}
// Behaivour change: Deleting a daemon set will no longer unschedule its pods (for now)
numNodes = waitForNodes(t, ds, expectedNodes, desiresErrCh, dsChangesErrCh)
Assert(t).AreEqual(numNodes, expectedNodes, "Unexpected number of nodes scheduled")
numNodes = waitForNodes(t, ds, 12, desiresErrCh, dsChangesErrCh)
Copy link
Collaborator

Choose a reason for hiding this comment

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

expected->12 in previous commit might be good, cuz this ain't schedule -> label

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, this number is nonsense - this test will fail. 🤷‍♂️

@@ -506,7 +506,7 @@ func TestFarmSchedule(t *testing.T) {
dsID = labeled.Labels.Get(DSIDLabel)
Assert(t).AreEqual(anotherDSData.ID.String(), dsID, "Unexpected dsID labeled")

dsStore.Delete(anotherDSData.ID)
err = dsStore.Delete(anotherDSData.ID)
Copy link
Collaborator

Choose a reason for hiding this comment

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

that was a line I added?

yeah it was.

I am sorry. The errors are completely bogus because I didn't assign too...

@rudle
Copy link
Contributor Author

rudle commented Feb 9, 2017

Merging on green

@rudle rudle merged commit 854e5ac into square:master Feb 9, 2017
@rudle rudle deleted the disable-ds-delete branch February 9, 2017 19:16

err = waitForPodsInIntent(consulStore, 0)
Assert(t).IsNil(err, "Unexpected number of pods scheduled")
err = waitForPodsInIntent(consulStore, len(beforeDeletePods))
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe this is what's causing test flakes - we'd like it to be 12 (Right?), but sometimes tests expect it to be 1, presumably because the scheduledPods call doesn't get all of them.

Copy link
Collaborator

Choose a reason for hiding this comment

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

that's probably it yep

numNodes = waitForNodes(t, ds, 0, desiresErrCh, dsChangesErrCh)
Assert(t).AreEqual(numNodes, 0, "took too long to unschedule")
// behavior change: Deleting a daemon set will no longer unschedule its pods (for now)
numNodes = waitForNodes(t, ds, 12, desiresErrCh, dsChangesErrCh)
Copy link
Collaborator

Choose a reason for hiding this comment

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

hey hold on a second. This line waits for the number of nodes to decrease to 12 (spoiler, it never will)

Copy link
Collaborator

Choose a reason for hiding this comment

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

This doesn't cause any test failures of course, but it adds 10 seconds to each test.

Then again, you may say that's a feature: We make sure that no pods are deleted for ten seconds.

Assert(t).AreEqual(numNodes, 0, "took too long to unschedule")
// behavior change: Deleting a daemon set will no longer unschedule its pods (for now)
numNodes = waitForNodes(t, ds, 12, desiresErrCh, dsChangesErrCh)
Assert(t).AreEqual(numNodes, expectedNodes, "Unexpected number of nodes labeled")
Copy link
Collaborator

Choose a reason for hiding this comment

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

and then this line checks that the number of nodes is 23, not 12

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants