Skip to content
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

Change the reconcile logic to include machines being deleted #342

Merged
merged 1 commit into from
Jun 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions pkg/controller/machineset/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,6 @@ func (c *MachineSetControllerImpl) createMachine(machineSet *v1alpha1.MachineSet
// shoudExcludeMachine returns true if the machine should be filtered out, false otherwise.
func shouldExcludeMachine(machineSet *v1alpha1.MachineSet, machine *v1alpha1.Machine) bool {
// Ignore inactive machines.
if machine.DeletionTimestamp != nil || !machine.DeletionTimestamp.IsZero() {
glog.V(4).Infof("Skipping machine (%v), as it is being deleted.", machine.Name)
return true
}

if metav1.GetControllerOf(machine) != nil && !metav1.IsControlledBy(machine, machineSet) {
glog.V(4).Infof("%s not controlled by %v", machine.Name, machineSet.Name)
return true
Expand Down
5 changes: 2 additions & 3 deletions pkg/controller/machineset/reconcile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,12 @@ func TestMachineSetControllerReconcileHandler(t *testing.T) {
expectedMachine: machineFromMachineSet(createMachineSet(1, "foo", "bar2", "acme"), "bar2"),
},
{
name: "scenario 9: the current machine is being deleted, thus a machine is created.",
name: "scenario 9: the current machine is being deleted, is still counted towards the machine set, no machine resource is created.",
startingMachineSets: []*v1alpha1.MachineSet{createMachineSet(1, "foo", "bar2", "acme")},
startingMachines: []*v1alpha1.Machine{setMachineDeleting(machineFromMachineSet(createMachineSet(1, "foo", "bar1", "acme"), "bar1"))},
machineSetToSync: "foo",
namespaceToSync: "acme",
expectedActions: []string{"create"},
expectedMachine: machineFromMachineSet(createMachineSet(1, "foo", "bar2", "acme"), "bar2"),
expectedActions: []string{},
},
{
name: "scenario 10: the current machine has no controller refs, owner refs preserved, machine should be adopted.",
Expand Down