You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Entry("Do not process machine deletion for object without finalizer", &data{
@@ -1174,23 +1183,31 @@ var _ = Describe("machine", func() {
1174
1183
machineutils.MachinePriority: "3",
1175
1184
},
1176
1185
map[string]string{
1177
-
"node": "fakeID-0",
1186
+
"node": "fakeNode-0",
1178
1187
},
1179
1188
true,
1180
1189
),
1190
+
nodes: []*corev1.Node{
1191
+
{
1192
+
ObjectMeta: metav1.ObjectMeta{
1193
+
Name: "fakeNode-0",
1194
+
},
1195
+
},
1196
+
},
1181
1197
},
1182
1198
action: action{
1183
1199
machine: "machine-0",
1184
1200
fakeDriver: &driver.FakeDriver{
1185
1201
VMExists: true,
1186
-
ProviderID: "fakeID-0",
1202
+
ProviderID: "fakeID",
1187
1203
NodeName: "fakeNode-0",
1188
1204
Err: nil,
1189
1205
},
1190
1206
},
1191
1207
expect: expect{
1192
-
err: fmt.Errorf("Machine deletion in process. Drain successful. %s", machineutils.InitiateVMDeletion),
1193
-
retry: machineutils.RetryOp,
1208
+
err: fmt.Errorf("Machine deletion in process. Drain successful. %s", machineutils.InitiateVMDeletion),
1209
+
retry: machineutils.RetryOp,
1210
+
nodeTerminationConditionIsSet: true,
1194
1211
machine: newMachine(
1195
1212
&v1alpha1.MachineTemplateSpec{
1196
1213
ObjectMeta: *newObjectMeta(objMeta, 0),
@@ -1645,7 +1662,7 @@ var _ = Describe("machine", func() {
1645
1662
),
1646
1663
},
1647
1664
}),
1648
-
Entry("Drain machine failure", &data{
1665
+
Entry("Drain machine failure due to node update failure", &data{
1649
1666
setup: setup{
1650
1667
secrets: []*corev1.Secret{
1651
1668
{
@@ -1688,14 +1705,14 @@ var _ = Describe("machine", func() {
1688
1705
machineutils.MachinePriority: "3",
1689
1706
},
1690
1707
map[string]string{
1691
-
"node": "fakeID-0",
1708
+
"node": "fakeNode-0",
1692
1709
},
1693
1710
true,
1694
1711
),
1695
1712
nodes: []*corev1.Node{
1696
1713
{
1697
1714
ObjectMeta: metav1.ObjectMeta{
1698
-
Name: "fakeID-0",
1715
+
Name: "fakeNode-0",
1699
1716
},
1700
1717
},
1701
1718
},
@@ -1715,7 +1732,7 @@ var _ = Describe("machine", func() {
1715
1732
},
1716
1733
},
1717
1734
expect: expect{
1718
-
err: fmt.Errorf("Failed to update node"),
1735
+
err: fmt.Errorf("failed to create update conditions for node \"fakeNode-0\": Failed to update node"),
1719
1736
retry: machineutils.RetryOp,
1720
1737
machine: newMachine(
1721
1738
&v1alpha1.MachineTemplateSpec{
@@ -1735,7 +1752,7 @@ var _ = Describe("machine", func() {
1735
1752
LastUpdateTime: metav1.Now(),
1736
1753
},
1737
1754
LastOperation: v1alpha1.LastOperation{
1738
-
Description: fmt.Sprintf("Drain failed due to - Failed to update node. Will retry in next sync. %s", machineutils.InitiateDrain),
1755
+
Description: fmt.Sprintf("Drain failed due to failure in update of node conditions - %s. Will retry in next sync. %s", "failed to create update conditions for node \"fakeNode-0\": Failed to update node", machineutils.InitiateDrain),
1739
1756
State: v1alpha1.MachineStateFailed,
1740
1757
Type: v1alpha1.MachineOperationDelete,
1741
1758
LastUpdateTime: metav1.Now(),
@@ -1873,7 +1890,7 @@ var _ = Describe("machine", func() {
description=fmt.Sprintf("Drain failed due to failure in update of node conditions - %s. Will retry in next sync. %s", err.Error(), machineutils.InitiateDrain)
901
+
state=v1alpha1.MachineStateFailed
902
+
phase=v1alpha1.MachineTerminating
920
903
921
-
// Return error even when machine object is updated
922
-
err=fmt.Errorf("Machine deletion in process. "+description)
923
-
} elseiferr!=nil&&forceDeleteMachine {
924
-
// Drain failed on force deletion
925
-
klog.Warningf("Drain failed for machine %q. However, since it's a force deletion shall continue deletion of VM. \nBuf:%v \nErrBuf:%v \nErr-Message:%v", machine.Name, buf, errBuf, err)
904
+
skipDrain=true
905
+
}
906
+
}
926
907
927
-
description=fmt.Sprintf("Drain failed due to - %s. However, since it's a force deletion shall continue deletion of VM. %s", err.Error(), machineutils.InitiateVMDeletion)
// Return error even when machine object is updated
939
+
err=fmt.Errorf("Machine deletion in process. "+description)
940
+
} elseiferr!=nil&&forceDeleteMachine {
941
+
// Drain failed on force deletion
942
+
klog.Warningf("Drain failed for machine %q. However, since it's a force deletion shall continue deletion of VM. \nBuf:%v \nErrBuf:%v \nErr-Message:%v", machine.Name, buf, errBuf, err)
943
+
944
+
description=fmt.Sprintf("Drain failed due to - %s. However, since it's a force deletion shall continue deletion of VM. %s", err.Error(), machineutils.InitiateVMDeletion)
0 commit comments