@@ -53,6 +53,7 @@ import (
53
53
"sigs.k8s.io/cluster-api/test/framework/bootstrap"
54
54
"sigs.k8s.io/cluster-api/test/framework/clusterctl"
55
55
"sigs.k8s.io/cluster-api/util"
56
+ v1beta2conditions "sigs.k8s.io/cluster-api/util/conditions/v1beta2"
56
57
)
57
58
58
59
// ClusterctlUpgradeSpecInput is the input for ClusterctlUpgradeSpec.
@@ -698,6 +699,10 @@ func ClusterctlUpgradeSpec(ctx context.Context, inputGetter func() ClusterctlUpg
698
699
}
699
700
}
700
701
702
+ Byf ("[%d] Verify v1beta2 Available and Ready conditions (if exist) to be true for Cluster and Machines" , i )
703
+ verifyV1Beta2ConditionsTrue (ctx , managementClusterProxy .GetClient (), workloadCluster .Name , workloadCluster .Namespace ,
704
+ []string {clusterv1 .AvailableV1Beta2Condition , clusterv1 .ReadyV1Beta2Condition })
705
+
701
706
Byf ("[%d] Verify client-side SSA still works" , i )
702
707
clusterUpdate := & unstructured.Unstructured {}
703
708
clusterUpdate .SetGroupVersionKind (clusterv1 .GroupVersion .WithKind ("Cluster" ))
@@ -760,6 +765,38 @@ func ClusterctlUpgradeSpec(ctx context.Context, inputGetter func() ClusterctlUpg
760
765
})
761
766
}
762
767
768
+ // verifyV1Beta2ConditionsTrue checks the Cluster and Machines of a Cluster that
769
+ // the given v1beta2 condition types are set to true without a message, if they exist.
770
+ func verifyV1Beta2ConditionsTrue (ctx context.Context , c client.Client , clusterName , clusterNamespace string , v1beta2conditionTypes []string ) {
771
+ cluster := framework .GetClusterByName (ctx , framework.GetClusterByNameInput {
772
+ Getter : c ,
773
+ Name : clusterName ,
774
+ Namespace : clusterNamespace ,
775
+ })
776
+ for _ , conditionType := range v1beta2conditionTypes {
777
+ if v1beta2conditions .Has (cluster , conditionType ) {
778
+ condition := v1beta2conditions .Get (cluster , conditionType )
779
+ Expect (condition .Status ).To (Equal (metav1 .ConditionTrue ), "The v1beta2 condition %q on the Cluster should be set to true" , conditionType )
780
+ Expect (condition .Message ).To (BeEmpty (), "The v1beta2 condition %q on the Cluster should have an empty message" , conditionType )
781
+ }
782
+ }
783
+
784
+ machines := framework .GetMachinesByCluster (ctx , framework.GetMachinesByClusterInput {
785
+ Lister : c ,
786
+ ClusterName : clusterName ,
787
+ Namespace : clusterNamespace ,
788
+ })
789
+ for _ , machine := range machines {
790
+ for _ , conditionType := range v1beta2conditionTypes {
791
+ if v1beta2conditions .Has (& machine , conditionType ) {
792
+ condition := v1beta2conditions .Get (& machine , conditionType )
793
+ Expect (condition .Status ).To (Equal (metav1 .ConditionTrue ), "The v1beta2 condition %q on the Machine %q should be set to true" , conditionType , machine .Name )
794
+ Expect (condition .Message ).To (BeEmpty (), "The v1beta2 condition %q on the Machine %q should have an empty message" , conditionType , machine .Name )
795
+ }
796
+ }
797
+ }
798
+ }
799
+
763
800
func setupClusterctl (ctx context.Context , clusterctlBinaryURL , clusterctlConfigPath string ) (string , string ) {
764
801
clusterctlBinaryPath := downloadToTmpFile (ctx , clusterctlBinaryURL )
765
802
0 commit comments