@@ -1510,6 +1510,25 @@ func TestMachineSetReconciler_reconcileUnhealthyMachines(t *testing.T) {
1510
1510
Type : clusterv1 .MachineOwnerRemediatedCondition ,
1511
1511
Status : corev1 .ConditionFalse ,
1512
1512
},
1513
+ {
1514
+ Type : clusterv1 .MachineHealthCheckSucceededCondition ,
1515
+ Status : corev1 .ConditionFalse ,
1516
+ },
1517
+ },
1518
+ V1Beta2 : & clusterv1.MachineV1Beta2Status {
1519
+ Conditions : []metav1.Condition {
1520
+ {
1521
+ Type : clusterv1 .MachineOwnerRemediatedV1Beta2Condition ,
1522
+ Status : metav1 .ConditionFalse ,
1523
+ Reason : clusterv1 .MachineOwnerRemediatedWaitingForRemediationV1Beta2Reason ,
1524
+ },
1525
+ {
1526
+ Type : clusterv1 .MachineHealthCheckSucceededV1Beta2Condition ,
1527
+ Status : metav1 .ConditionFalse ,
1528
+ Reason : clusterv1 .MachineHealthCheckHasRemediateAnnotationV1Beta2Reason ,
1529
+ Message : "Marked for remediation via cluster.x-k8s.io/remediate-machine annotation" ,
1530
+ },
1531
+ },
1513
1532
},
1514
1533
},
1515
1534
}
@@ -1518,6 +1537,34 @@ func TestMachineSetReconciler_reconcileUnhealthyMachines(t *testing.T) {
1518
1537
Name : "healthy-machine" ,
1519
1538
Namespace : "default" ,
1520
1539
},
1540
+ Status : clusterv1.MachineStatus {
1541
+ Conditions : []clusterv1.Condition {
1542
+ {
1543
+ // This condition should be cleaned up because HealthCheckSucceeded is true.
1544
+ Type : clusterv1 .MachineOwnerRemediatedCondition ,
1545
+ Status : corev1 .ConditionFalse ,
1546
+ },
1547
+ {
1548
+ Type : clusterv1 .MachineHealthCheckSucceededCondition ,
1549
+ Status : corev1 .ConditionTrue ,
1550
+ },
1551
+ },
1552
+ V1Beta2 : & clusterv1.MachineV1Beta2Status {
1553
+ Conditions : []metav1.Condition {
1554
+ {
1555
+ // This condition should be cleaned up because HealthCheckSucceeded is true.
1556
+ Type : clusterv1 .MachineOwnerRemediatedV1Beta2Condition ,
1557
+ Status : metav1 .ConditionFalse ,
1558
+ Reason : clusterv1 .MachineOwnerRemediatedWaitingForRemediationV1Beta2Reason ,
1559
+ },
1560
+ {
1561
+ Type : clusterv1 .MachineHealthCheckSucceededV1Beta2Condition ,
1562
+ Status : metav1 .ConditionTrue ,
1563
+ Reason : clusterv1 .MachineHealthCheckSucceededV1Beta2Reason ,
1564
+ },
1565
+ },
1566
+ },
1567
+ },
1521
1568
}
1522
1569
1523
1570
machines := []* clusterv1.Machine {unhealthyMachine , healthyMachine }
@@ -1590,6 +1637,25 @@ func TestMachineSetReconciler_reconcileUnhealthyMachines(t *testing.T) {
1590
1637
Type : clusterv1 .MachineOwnerRemediatedCondition ,
1591
1638
Status : corev1 .ConditionFalse ,
1592
1639
},
1640
+ {
1641
+ Type : clusterv1 .MachineHealthCheckSucceededCondition ,
1642
+ Status : corev1 .ConditionFalse ,
1643
+ },
1644
+ },
1645
+ V1Beta2 : & clusterv1.MachineV1Beta2Status {
1646
+ Conditions : []metav1.Condition {
1647
+ {
1648
+ Type : clusterv1 .MachineOwnerRemediatedV1Beta2Condition ,
1649
+ Status : metav1 .ConditionFalse ,
1650
+ Reason : clusterv1 .MachineOwnerRemediatedWaitingForRemediationV1Beta2Reason ,
1651
+ },
1652
+ {
1653
+ Type : clusterv1 .MachineHealthCheckSucceededV1Beta2Condition ,
1654
+ Status : metav1 .ConditionFalse ,
1655
+ Reason : clusterv1 .MachineHealthCheckHasRemediateAnnotationV1Beta2Reason ,
1656
+ Message : "Marked for remediation via cluster.x-k8s.io/remediate-machine annotation" ,
1657
+ },
1658
+ },
1593
1659
},
1594
1660
},
1595
1661
}
@@ -1598,6 +1664,34 @@ func TestMachineSetReconciler_reconcileUnhealthyMachines(t *testing.T) {
1598
1664
Name : "healthy-machine" ,
1599
1665
Namespace : "default" ,
1600
1666
},
1667
+ Status : clusterv1.MachineStatus {
1668
+ Conditions : []clusterv1.Condition {
1669
+ {
1670
+ // This condition should be cleaned up because HealthCheckSucceeded is true.
1671
+ Type : clusterv1 .MachineOwnerRemediatedCondition ,
1672
+ Status : corev1 .ConditionFalse ,
1673
+ },
1674
+ {
1675
+ Type : clusterv1 .MachineHealthCheckSucceededCondition ,
1676
+ Status : corev1 .ConditionTrue ,
1677
+ },
1678
+ },
1679
+ V1Beta2 : & clusterv1.MachineV1Beta2Status {
1680
+ Conditions : []metav1.Condition {
1681
+ {
1682
+ // This condition should be cleaned up because HealthCheckSucceeded is true.
1683
+ Type : clusterv1 .MachineOwnerRemediatedV1Beta2Condition ,
1684
+ Status : metav1 .ConditionFalse ,
1685
+ Reason : clusterv1 .MachineOwnerRemediatedWaitingForRemediationV1Beta2Reason ,
1686
+ },
1687
+ {
1688
+ Type : clusterv1 .MachineHealthCheckSucceededV1Beta2Condition ,
1689
+ Status : metav1 .ConditionTrue ,
1690
+ Reason : clusterv1 .MachineHealthCheckSucceededV1Beta2Reason ,
1691
+ },
1692
+ },
1693
+ },
1694
+ },
1601
1695
}
1602
1696
1603
1697
machines := []* clusterv1.Machine {unhealthyMachine , healthyMachine }
@@ -1636,7 +1730,7 @@ func TestMachineSetReconciler_reconcileUnhealthyMachines(t *testing.T) {
1636
1730
"The operation will continue after the preflight check(s) pass" ,
1637
1731
}, v1beta2conditions .IgnoreLastTransitionTime (true )))
1638
1732
1639
- // Verify the healthy machine continues to not have the MachineOwnerRemediated condition.
1733
+ // Verify the healthy machine does not have the MachineOwnerRemediated condition.
1640
1734
m = & clusterv1.Machine {}
1641
1735
g .Expect (r .Client .Get (ctx , client .ObjectKeyFromObject (healthyMachine ), m )).To (Succeed ())
1642
1736
g .Expect (m .DeletionTimestamp .IsZero ()).To (BeTrue ())
@@ -1709,6 +1803,25 @@ func TestMachineSetReconciler_reconcileUnhealthyMachines(t *testing.T) {
1709
1803
Type : clusterv1 .MachineOwnerRemediatedCondition ,
1710
1804
Status : corev1 .ConditionFalse ,
1711
1805
},
1806
+ {
1807
+ Type : clusterv1 .MachineHealthCheckSucceededCondition ,
1808
+ Status : corev1 .ConditionFalse ,
1809
+ },
1810
+ },
1811
+ V1Beta2 : & clusterv1.MachineV1Beta2Status {
1812
+ Conditions : []metav1.Condition {
1813
+ {
1814
+ Type : clusterv1 .MachineOwnerRemediatedV1Beta2Condition ,
1815
+ Status : metav1 .ConditionFalse ,
1816
+ Reason : clusterv1 .MachineOwnerRemediatedWaitingForRemediationV1Beta2Reason ,
1817
+ },
1818
+ {
1819
+ Type : clusterv1 .MachineHealthCheckSucceededV1Beta2Condition ,
1820
+ Status : metav1 .ConditionFalse ,
1821
+ Reason : clusterv1 .MachineHealthCheckHasRemediateAnnotationV1Beta2Reason ,
1822
+ Message : "Marked for remediation via cluster.x-k8s.io/remediate-machine annotation" ,
1823
+ },
1824
+ },
1712
1825
},
1713
1826
},
1714
1827
}
@@ -1717,6 +1830,34 @@ func TestMachineSetReconciler_reconcileUnhealthyMachines(t *testing.T) {
1717
1830
Name : "healthy-machine" ,
1718
1831
Namespace : "default" ,
1719
1832
},
1833
+ Status : clusterv1.MachineStatus {
1834
+ Conditions : []clusterv1.Condition {
1835
+ {
1836
+ // This condition should be cleaned up because HealthCheckSucceeded is true.
1837
+ Type : clusterv1 .MachineOwnerRemediatedCondition ,
1838
+ Status : corev1 .ConditionFalse ,
1839
+ },
1840
+ {
1841
+ Type : clusterv1 .MachineHealthCheckSucceededCondition ,
1842
+ Status : corev1 .ConditionTrue ,
1843
+ },
1844
+ },
1845
+ V1Beta2 : & clusterv1.MachineV1Beta2Status {
1846
+ Conditions : []metav1.Condition {
1847
+ {
1848
+ // This condition should be cleaned up because HealthCheckSucceeded is true.
1849
+ Type : clusterv1 .MachineOwnerRemediatedV1Beta2Condition ,
1850
+ Status : metav1 .ConditionFalse ,
1851
+ Reason : clusterv1 .MachineOwnerRemediatedWaitingForRemediationV1Beta2Reason ,
1852
+ },
1853
+ {
1854
+ Type : clusterv1 .MachineHealthCheckSucceededV1Beta2Condition ,
1855
+ Status : metav1 .ConditionTrue ,
1856
+ Reason : clusterv1 .MachineHealthCheckSucceededV1Beta2Reason ,
1857
+ },
1858
+ },
1859
+ },
1860
+ },
1720
1861
}
1721
1862
1722
1863
machines := []* clusterv1.Machine {unhealthyMachine , healthyMachine }
@@ -1764,7 +1905,7 @@ func TestMachineSetReconciler_reconcileUnhealthyMachines(t *testing.T) {
1764
1905
Message : "Machine won't be remediated because it is pending removal due to rollout" ,
1765
1906
}, v1beta2conditions .IgnoreLastTransitionTime (true )))
1766
1907
1767
- // Verify the healthy machine continues to not have the MachineOwnerRemediated condition.
1908
+ // Verify the healthy machine does not have the MachineOwnerRemediated condition.
1768
1909
m = & clusterv1.Machine {}
1769
1910
g .Expect (r .Client .Get (ctx , client .ObjectKeyFromObject (healthyMachine ), m )).To (Succeed ())
1770
1911
g .Expect (m .DeletionTimestamp .IsZero ()).To (BeTrue ())
@@ -1795,7 +1936,7 @@ func TestMachineSetReconciler_reconcileUnhealthyMachines(t *testing.T) {
1795
1936
Reason : clusterv1 .MachineSetMachineRemediationMachineDeletedV1Beta2Reason ,
1796
1937
}, v1beta2conditions .IgnoreLastTransitionTime (true )))
1797
1938
1798
- // Verify (again) the healthy machine continues to not have the MachineOwnerRemediated condition.
1939
+ // Verify (again) the healthy machine does not have the MachineOwnerRemediated condition.
1799
1940
m = & clusterv1.Machine {}
1800
1941
g .Expect (r .Client .Get (ctx , client .ObjectKeyFromObject (healthyMachine ), m )).To (Succeed ())
1801
1942
g .Expect (m .DeletionTimestamp .IsZero ()).To (BeTrue ())
@@ -1872,6 +2013,25 @@ func TestMachineSetReconciler_reconcileUnhealthyMachines(t *testing.T) {
1872
2013
Type : clusterv1 .MachineOwnerRemediatedCondition ,
1873
2014
Status : corev1 .ConditionFalse ,
1874
2015
},
2016
+ {
2017
+ Type : clusterv1 .MachineHealthCheckSucceededCondition ,
2018
+ Status : corev1 .ConditionFalse ,
2019
+ },
2020
+ },
2021
+ V1Beta2 : & clusterv1.MachineV1Beta2Status {
2022
+ Conditions : []metav1.Condition {
2023
+ {
2024
+ Type : clusterv1 .MachineOwnerRemediatedV1Beta2Condition ,
2025
+ Status : metav1 .ConditionFalse ,
2026
+ Reason : clusterv1 .MachineOwnerRemediatedWaitingForRemediationV1Beta2Reason ,
2027
+ },
2028
+ {
2029
+ Type : clusterv1 .MachineHealthCheckSucceededV1Beta2Condition ,
2030
+ Status : metav1 .ConditionFalse ,
2031
+ Reason : clusterv1 .MachineHealthCheckHasRemediateAnnotationV1Beta2Reason ,
2032
+ Message : "Marked for remediation via cluster.x-k8s.io/remediate-machine annotation" ,
2033
+ },
2034
+ },
1875
2035
},
1876
2036
},
1877
2037
})
@@ -1882,6 +2042,34 @@ func TestMachineSetReconciler_reconcileUnhealthyMachines(t *testing.T) {
1882
2042
Name : "healthy-machine" ,
1883
2043
Namespace : "default" ,
1884
2044
},
2045
+ Status : clusterv1.MachineStatus {
2046
+ Conditions : []clusterv1.Condition {
2047
+ {
2048
+ // This condition should be cleaned up because HealthCheckSucceeded is true.
2049
+ Type : clusterv1 .MachineOwnerRemediatedCondition ,
2050
+ Status : corev1 .ConditionFalse ,
2051
+ },
2052
+ {
2053
+ Type : clusterv1 .MachineHealthCheckSucceededCondition ,
2054
+ Status : corev1 .ConditionTrue ,
2055
+ },
2056
+ },
2057
+ V1Beta2 : & clusterv1.MachineV1Beta2Status {
2058
+ Conditions : []metav1.Condition {
2059
+ {
2060
+ // This condition should be cleaned up because HealthCheckSucceeded is true.
2061
+ Type : clusterv1 .MachineOwnerRemediatedV1Beta2Condition ,
2062
+ Status : metav1 .ConditionFalse ,
2063
+ Reason : clusterv1 .MachineOwnerRemediatedWaitingForRemediationV1Beta2Reason ,
2064
+ },
2065
+ {
2066
+ Type : clusterv1 .MachineHealthCheckSucceededV1Beta2Condition ,
2067
+ Status : metav1 .ConditionTrue ,
2068
+ Reason : clusterv1 .MachineHealthCheckSucceededV1Beta2Reason ,
2069
+ },
2070
+ },
2071
+ },
2072
+ },
1885
2073
}
1886
2074
1887
2075
fakeClient := fake .NewClientBuilder ().WithObjects (cluster , machineDeployment , healthyMachine ).
@@ -1936,7 +2124,7 @@ func TestMachineSetReconciler_reconcileUnhealthyMachines(t *testing.T) {
1936
2124
}
1937
2125
}
1938
2126
1939
- // Verify the healthy machine continues to not have the MachineOwnerRemediated condition.
2127
+ // Verify the healthy machine does not have the MachineOwnerRemediated condition.
1940
2128
m := & clusterv1.Machine {}
1941
2129
g .Expect (r .Client .Get (ctx , client .ObjectKeyFromObject (healthyMachine ), m )).To (Succeed ())
1942
2130
g .Expect (conditions .Has (m , condition )).
@@ -2026,7 +2214,7 @@ func TestMachineSetReconciler_reconcileUnhealthyMachines(t *testing.T) {
2026
2214
}
2027
2215
validateSecondPass (false )
2028
2216
2029
- // Verify (again) the healthy machine continues to not have the MachineOwnerRemediated condition.
2217
+ // Verify (again) the healthy machine does not have the MachineOwnerRemediated condition.
2030
2218
g .Expect (r .Client .Get (ctx , client .ObjectKeyFromObject (healthyMachine ), m )).To (Succeed ())
2031
2219
g .Expect (conditions .Has (m , condition )).
2032
2220
To (BeFalse (), "Machine should not have the %s condition set" , condition )
@@ -2048,7 +2236,7 @@ func TestMachineSetReconciler_reconcileUnhealthyMachines(t *testing.T) {
2048
2236
// Validate and remove finalizers for in flight machines.
2049
2237
validateSecondPass (true )
2050
2238
2051
- // Verify (again) the healthy machine continues to not have the MachineOwnerRemediated condition.
2239
+ // Verify (again) the healthy machine does not have the MachineOwnerRemediated condition.
2052
2240
g .Expect (r .Client .Get (ctx , client .ObjectKeyFromObject (healthyMachine ), m )).To (Succeed ())
2053
2241
g .Expect (conditions .Has (m , condition )).
2054
2242
To (BeFalse (), "Machine should not have the %s condition set" , condition )
@@ -2073,7 +2261,7 @@ func TestMachineSetReconciler_reconcileUnhealthyMachines(t *testing.T) {
2073
2261
g .Expect (apierrors .IsNotFound (err )).To (BeTrue (), "expected machine %d to be deleted: %v" , i )
2074
2262
}
2075
2263
2076
- // Verify (again) the healthy machine continues to not have the MachineOwnerRemediated condition.
2264
+ // Verify (again) the healthy machine does not have the MachineOwnerRemediated condition.
2077
2265
g .Expect (r .Client .Get (ctx , client .ObjectKeyFromObject (healthyMachine ), m )).To (Succeed ())
2078
2266
g .Expect (conditions .Has (m , condition )).
2079
2267
To (BeFalse (), "Machine should not have the %s condition set" , condition )
0 commit comments